Repository navigation
rangeread: find each span's extents by binary search - #7
Merged
Merged
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-01a1c021-3012-771f-830c-30aa032b59ff Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #6.
rangeread.Readscanned every extent for every planned span, O(spans × extents). It now sorts the extents once and binary-searches the ones a span can overlap (ReadPlannedkeeps its signature and behaviour).BenchmarkReadManyExtents(10,000 × 1 KiB extents, 8 KiB stride,mem, -count=6, benchstat p=0.002): 122.7ms → 43.6ms (-64%). At 100–1,000 extents there is no measurable change. Against a real object store the network cost dominates, so this matters only for very many extents perRead.Not done: fs listing. A page already costs only the directory it touches. Paging a flat 5,000-file directory in pages of 500 is about 3 ms per page (re-read and sort of that directory). Removing that needs a directory cursor or index, a design change for a modest gain, so I left it.
Verified: gofmt, vet, staticcheck,
go test -race ./....