Repository navigation
perf: speed up sparse MinHash bucket scans - #9733
Conversation
|
Thanks for the PR. Two concerns: 1. Prefix sampling is unstable
2. Regressions in some cases Prewarmed criterion runs, same text generator as
The default config can never use the heap ( |
|
@zhangyue19921010 With these changes, the 256-band case with eight duplicates at the start is about 2.1× faster. The default configuration and 64-band query are about the same. The 64-band full walk is still around 1.7% slower, down from roughly 4%, so there’s a small tradeoff remaining. |
10e1c42 to
430cfbc
Compare
Reconsider heap selection after each overlap window and bypass adaptive bookkeeping for permanently linear scans. Extend transition and low-bucket tests and benchmark the review configurations.
3bc762c to
3b5fc24
Compare
Exercise a real multi-page sparse index whose production bucket walk admits heap selection and refills windows, then compare ordered candidates with an independent bands-file oracle.
There was a problem hiding this comment.
The production selector is unchanged. The new sparse-index regression checks heap admission and consumed page refills against an independent bands-file oracle. Refreshed verification supports ordered candidates and exact shared-band counts through strategy changes, exhaustion, and seek.
Earlier paired prewarmed benchmarks showed roughly 2× improvement for the 256-band fixture with eight leading duplicates, with default query fixtures near parity. The acknowledged small 64-band full-walk overhead remains a non-blocking trade-off. Performance was not remeasured on this head; gains remain workload-dependent, and cold-query speedup is unestablished.
Xuanwo
left a comment
There was a problem hiding this comment.
Reviewed the latest MinHash selector, heap/window/seek state transitions, and the new real-index refill and posting-oracle regression. The retained can_remap behavior, remap tests, and benchmark registrations match current main. Local MinHash tests and workspace Clippy passed, and the applicable hosted checks are complete. The measured sparse-workload benefit and bounded default-control cost are documented.
Summary
MinHash candidate selection scanned every active bucket head for each emitted document. For sparse searches with many buckets, this repeated work dominates.
Performance
Same 20,000-document harness, current
main, and the repository'srelease-with-debugprofile. Two alternating runs per implementation; values are the range of Criterion time estimates.sparse_256querydefault_16querydense_64queryThe stable gain is limited to the prewarmed sparse 256-band workload. The low-band
default_16query control repeated the same direction in both runs:6.7927 -> 7.1054 us(+4.6%, +0.31 us) and6.6546 -> 7.7645 us(+16.7%, +1.11 us). This is an accepted bounded cost in this fixture, not evidence of a universal default-config throughput regression.dense_64varied with run order. No general or cold-query speedup is claimed. Measurements use local files and prewarmed caches, not physically cold disk or remote storage.The selector was measured at
0b00653e6568414c836d322ea4afc43f028c1242; the later134ba47cb1e1dd24f85f558c300f0a6fa35103b7commit is test-only and does not enter the benchmark binary.Validation
cargo fmt --all -- --checkcargo clippy --profile ci --locked --features <all workspace features> --all-targets -- -D warningscargo test --profile ci -p lance-index --lib minhash_lsh— 63 passedThe new real-index regression admits the heap after the bounded sample, consumes a window supplied by the production refill path, and matches every ordered candidate and shared-band count with an independent bands-file oracle. A rejecting-mask cursor walk was also measured as a diagnostic, but is not presented here as whole-dataset throughput.