Skip to content

perf(puffin): reuse prefetched footer payload - #1809

Open
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:perf/puffin-tail-footer-reuse
Open

perf(puffin): reuse prefetched footer payload#1809
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:perf/puffin-tail-footer-reuse

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Reuse the footer payload from the initial 8 KiB tail read when the whole footer fits.
  • Keep the existing io.SectionReader fallback for larger footers.
  • Add read-count coverage for both paths.

Why

readFooter already reads the tail to avoid extra object-store round trips. Small footers were still decoded from a section reader backed by the underlying ReaderAt, so the payload was read again.

Performance

With a small footer and a simulated 5 ms delay for every range read:

  • Before: 17.8 ms/op
  • After: 12.2 ms/op
  • About 1.5x faster

This removes one redundant range read from the small-footer path.

The benchmark used 5 runs of 20 iterations on an Apple M1 Pro. The exact numbers will vary with object-store latency.

Tests

  • go test ./puffin
  • go test -race ./puffin
  • go test ./...

@fallintoplace
fallintoplace marked this pull request as ready for review August 13, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant