Xuanwo opened a new pull request, #306:
URL: https://github.com/apache/datasketches-rust/pull/306

   Ordinary `BloomFilter::insert` currently uses the membership-returning 
bit-setting path. Set its bits with unconditional OR writes and increment the 
bit count only for newly set bits, directly in the insertion loop. 
`contains_and_insert` keeps conditional writes, which avoid unnecessary stores 
for already-present items. Hashing and bit positions are unchanged.
   
   ### Benchmark
   
   Measured `079c7de2b10156b985ca31a1eff232d22772dfc4` against 
`675e3e123fda6da19657d345038252b16adc2ebb` on an isolated EC2 c7i.2xlarge (Xeon 
Platinum 8488C), Rust 1.99.1 release defaults, one process pinned to CPU 2, 
with warmup and seven alternating pairs. Each insertion benchmark times 20,000 
public calls into a freshly prepared filter; allocation and fixture cloning are 
outside timing. Latencies below are per item.
   
   | Workload | Before | After | Paired speedup |
   | --- | ---: | ---: | ---: |
   | New u64 insertion, 7 hashes | 63.558 ns | 28.381 ns | 2.24× |
   | New u64 insertion, 12 hashes | 109.762 ns | 39.420 ns | 2.77× |
   | New 32-byte insertion, 7 hashes | 73.787 ns | 38.882 ns | 1.89× |
   | Repeated u64 insertion, 1 hash | 12.591 ns | 12.877 ns | 0.98× |
   | Membership miss, 7 hashes | 35.333 ns | 36.721 ns | 0.96× |
   
   The one-hash repeated-insertion case costs about 0.3 ns more. The unchanged 
membership-miss path also measured about 1.4 ns slower (roughly 4%); this is an 
observed binary-level tradeoff, not an attributed cost of the insertion loop. 
Membership-returning insertion remains approximately neutral. Targeted checks 
compare membership, return values, exact bit popcounts, and serialized bytes, 
including collisions within a word and non-power-of-two capacities. Latencies 
are sample medians; speedups are medians of paired ratios.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to