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

   Follow-up to #402 with another optimization @tisonkun suggested in review.
   
   - `Hll6` register access does one bounds check instead of two.
   - `register_position` is now `#[inline]`. It isn't generic, so the generic 
batch loop in `update_coupons`, which is compiled in the caller's crate, called 
it once per coupon.
   
   I left out `#[inline(never)]` on `update_coupons`. It sped up `Hll4` and 
`Hll8` batches on M1, but not on x86, where it made `Hll6` batches slower.
   
   ## Benchmarks
   
   CPU time relative to main, so lower is faster. Each value is the median over 
10 paired blocks, and every sample ran for at least 300 ms. Serialized bytes 
and estimates matched main after every batch.
   
   Dense `Hll6` sketch at `lg_k` 14, 1M values in batches of 8,192 
(`register_position` change only, distinct / duplicate-heavy input):
   
   | Workload | M1 Max | Xeon 8259CL |
   | --- | --- | --- |
   | `update_with_coupons` with precomputed coupons | 0.95 / 0.94 | 0.80 / 0.79 
|
   | `update_with_coupons` with hashing | 0.96 / 0.97 | 0.94 / 0.95 |
   
   The single bounds check makes scalar `Hll6` `update` about 4% faster on M1 
and makes no difference on x86. Precomputed `Hll8` `update_with_coupon` 
measured 8% slower on x86, but its machine code is identical to main; only the 
function's alignment moved.
   
   The x86 builds used `-C llvm-args=-x86-branches-within-32B-boundaries`, 
because identical code otherwise moved by up to 35% depending on alignment.
   


-- 
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