Introduce a fast masked key for sorting#135
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a fast u64 sort key for masked similarity ordering of GeoDiffCount filters, intended to reduce the cost of sorting/bucketing large filter sets (and thereby speed up MST construction workflows that rely on masked ordering).
Changes:
- Adds
GeoDiffCount::masked_sort_key(mask, mask_size) -> u64to accelerate masked sorting with tie-break fallback tocmp_masked. - Documents the masked-sort approach and reports benchmark results in
crates/geo_filters/README.md. - Adds a Criterion benchmark (
masked_sort) to measure keyed sorting vs directcmp_maskedsorting.
Show a summary per file
| File | Description |
|---|---|
| crates/geo_filters/src/diff_count.rs | Adds masked_sort_key implementation and unit test validating key ordering against cmp_masked. |
| crates/geo_filters/README.md | Documents masked sorting strategy, example usage, and benchmark results. |
| crates/geo_filters/evaluation/masked_sort.rs | Adds Criterion benchmark comparing cmp_masked sorting vs key-based sorting and key construction cost. |
| crates/geo_filters/Cargo.toml | Registers the new masked_sort benchmark target. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Low
Comment on lines
+52
to
+55
| [[bench]] | ||
| name = "masked_sort" | ||
| path = "evaluation/masked_sort.rs" | ||
| harness = false |
itsibitzi
approved these changes
Jul 6, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Resolve conflicts in Cargo.toml (keep both nearest_neighbor and masked_sort bench targets) and README.md (keep both the nearest-neighbor metric and masked-similarity sorting sections). diff_count.rs auto-merged; fixed pre-existing indentation of masked_sort_key. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
see readme for more information.
This should speed up MST construction significantly