Skip to content

perf: streamline sketch update paths - #267

Merged
tisonkun merged 1 commit into
mainfrom
codex/sketch-update-performance
Sep 2, 2026
Merged

perf: streamline sketch update paths#267
tisonkun merged 1 commit into
mainfrom
codex/sketch-update-performance

Conversation

@tisonkun

@tisonkun tisonkun commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Make Bloom filter bit-setting operations report the previous bit state, allowing contains_and_insert to check membership and insert in one pass while reusing the existing set_bits and set_bit concepts.
  • Add a benchmark for contains_and_insert when all queried values are already present.
  • Express the Theta-family hash table resize and rebuild thresholds directly with exact integer relationships, removing the resize threshold constant and floating-point conversion from this shared Theta/Tuple code.

Performance

Measured locally with 10,000 present u64 values per iteration:

cargo bench --package benchmarks --bench benchmarks -- bloom::update --min-time 3 --sample-count 30
Benchmark main median This PR median Change
bloom::update::contains_and_insert_present_u64 220.4 µs 161.8 µs 26.6% lower

The Theta-family threshold change is included as a code simplification rather than as a general performance claim: 32-byte Theta and Tuple update measurements remained close to the baseline, while shorter-input results varied more noticeably.

Validation

  • cargo x check
  • cargo x test
  • cargo x lint

@tisonkun
tisonkun enabled auto-merge (squash) September 2, 2026 13:09
@tisonkun
tisonkun merged commit bb6bbec into main Sep 2, 2026
10 checks passed
@tisonkun
tisonkun deleted the codex/sketch-update-performance branch September 2, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant