remove the loop from StaticSortedFile::lookup (#91688)
## Summary `StaticSortedFile::lookup` previously used a loop to traverse blocks, even though SST files always have exactly one index block (the last block). This unrolls the loop into a straight-line read of the index block followed by a direct dispatch to the key block, removing the loop overhead and the redundant empty-block `ensure!` checks that were subsumed by the length checks inside the key block functions. ## Benchmark results Read path (`static_sorted_file_lookup/entries_1000.00Ki`), canary vs this branch: | Benchmark | Canary | Branch | Change | |-----------|--------|--------|--------| | hit/uncached | 7.02 µs | 6.67 µs | **-5.0%** | | hit/cached | 141.0 ns | 134.2 ns | **-4.8%** | | miss/uncached | 5.16 µs | 5.08 µs | **-1.6%** | | miss/cached | 243.5 ns | 237.5 ns | **-2.5%** | A slight improvement is to be expected from simplifying control flow ## Test plan - [x] `cargo test -p turbo-persistence` — all tests passing - [x] Read path benchmarks verified improvement over canary
Showing
Please
register
or
sign in
to comment