Repository navigation
perf(index): size BloomFilter zones without serializing and skip the copy on remapped load - #10750
Merged
Merged
Conversation
Xuanwo
added a commit
that referenced
this pull request
Nov 12, 2026
Main's `ci` profile lint fails with `clippy::undocumented_unsafe_blocks` at `DictionaryDataBlock::gather_variable_width_typed` (`data.rs:1200`), which blocks the full Rust lint for every PR in the workspace, #10750 included. The existing `SAFETY:` note sits inside the outer unsafe block, so it justifies the unchecked offset reads but leaves the block itself undocumented. This moves the justification above the block and extends it to cover the rest of it: the index/offset bounds proven by `validate_offsets_for_append` and the first pass, `total_bytes` fitting both `usize` and `T`, the two output allocations being disjoint from the dictionary data, and every rebased offset and payload byte being written before the `set_len` calls. Comment-only; no runtime change. Context: the block came in with #10911. Validation on this branch: `cargo fmt --all -- --check` and `cargo clippy --profile ci --all --tests --benches -- -D warnings` both pass.
Xuanwo
approved these changes
Nov 12, 2026
Xuanwo
left a comment
Member
There was a problem hiding this comment.
Approved. The patch replaces the serialized-size estimate with Sbbf::size_bytes() and removes the redundant filter copy on remapped load, and the fragment-reuse BloomFilter contract cases exercise the remapped path. On integration head 79ddcf4 the merge of main e91343d has no bloomfilter.rs overlap: all 13 workflows succeeded, 39 check runs succeeded and 5 skipped (skips are not counted as passes), and the workspace clippy plus the 22 BloomFilter and 4 fragment-reuse BloomFilter tests pass locally. The performance figures remain author-reported; no independent benchmark was run here. No blockers.
Contributor
Author
|
Thank you @Xuanwo |
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.
Closes #10744.
Deep size now uses
Sbbf::size_bytes(), which returns the same number asto_bytes().len()without building the bytes. The internal loader returns the index by value, soload_with_remappingsets the remapper on it directly, andloadwraps it in anArcas before.The author measured on a release build on an Apple M2 Max, an index with 2000 zones, median of 7 runs:
deep_size_ofgoes from 4554 µs to 3 µs. The removed copy took 1921 µs and allocated a second copy of the 65.6 MB of filters. These figures are author-reported and were not independently reproduced here.How was this patch tested
test_bloomfilter_deep_size_equals_serialized_payloadchecks that an index's deep size is its struct sizes plus each zone's serialized filter size. This PR does not change that value, so the test pins the result and not the speed. The existing fragment reuse contract tests for BloomFilter with tagged histories go throughload_with_remapping.On the head merged with
mainat e91343d:cargo fmt --all -- --checkand the full workspacecargo clippy --profile ci --all --tests --benches -- -D warningspass. The 22 lance-index BloomFilter tests and the BloomFilter cases ofscalar_queries_translate_deleted_sources_and_lazy_blocksandlegacy_scalar_lifecycle_never_enters_new_readerpass on that head.Sbbf::test_serialization(size_bytesequalsto_bytes().len()) was verified on the same unchangedlance-coreinputs and is unaffected by the main advances.