perf: optimize query hot paths#16
Merged
Merged
Conversation
- Inline single-byte traversal in PrefixIter::next() instead of calling find() with 1-byte slices per byte - Add unchecked indexing helpers (node_unchecked, ninfo_unchecked) with debug_assert guards for find/begin/next inner loops - Derive Copy on Node and NInfo (small POD types) - Eliminate .clone() on hot paths in pop_e_node, erase__, pop_block - Add #[inline] to find, begin, next methods - Fix benchmarks to isolate build from query time Benchmark results vs baseline: exact_match_search: 10.99ns -> 9.07ns (~17%) common_prefix_search: 25.60ns -> 23.01ns (~10%) common_prefix_predict: 87.35ns -> 68.71ns (~21%)
afc9e15 to
da7ba11
Compare
Owner
|
Thanks for the PR. I'll release the latest change as soon as I have time. |
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.
PrefixIter::next()instead of callingfind()with 1-byte slices per bytenode_unchecked,ninfo_unchecked) withdebug_assertguards for find/begin/next inner loopsCopyon Node and NInfo (small POD types).clone()on hot paths inpop_e_node,erase__,pop_block#[inline]to find, begin, next methodsBenchmark results vs baseline on Apple M4 Max: