optimize lookup to compete with abseil flat_hash_map#2
Draft
joshuaisaact wants to merge 187 commits intomainfrom
Draft
optimize lookup to compete with abseil flat_hash_map#2joshuaisaact wants to merge 187 commits intomainfrom
joshuaisaact wants to merge 187 commits intomainfrom
Conversation
This was referenced Mar 24, 2026
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.
Why
The elastic hash table was roughly tied with Google's abseil flat_hash_map. This PR optimizes the SIMD lookup path, makes the lookup paper-faithful (100% find rate via multi-tier search), and adds rigorous benchmarking with verification.
What
Implementation changes to
src/hybrid.zig:entriesarrayBenchmark harness (
bench-abseil.cpp,src/autobench.zig,bench-v2.sh):reserve(n)/init(n)Verification (
verify-results.md,bench-verify.cpp,bench-realistic.cpp):Verified results (shuffled random access, n=1M u64 keys):
Sweet spot: 500K-2M elements at 10-75% load. The tiered metadata layout keeps hot fingerprints (1MB) in L2 while abseil's control bytes (2MB) spill to L3. See
verify-results.mdfor the full verification including caveats.40+ experiments, ~75% revert rate. Full logs in
results-v2.tsvandresults-v3.tsv.References