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

   An empty CPC union contributes zero bits to every coupon row. At matching 
effective `lg_k`, source and destination rows have the same index, so the first 
merge computes `0 | source_row` for every row. For a Sliding input, 
`build_bit_matrix` already reconstructs the complete coupon set from the window 
and its exceptions. The union can keep that newly allocated matrix directly.
   
   This saves one allocation of `8 * K` bytes and one full row-wise OR. The 
precision check runs after the union adjusts its effective `lg_k`. A wider 
source still needs its rows folded into the narrower destination. An 
integration test compares that result byte-for-byte with a union built from the 
same values at the destination precision.
   
   ### First-merge benchmark
   
   Each repetition builds one Sliding sketch from `32 * K` distinct integers. 
Each round creates a fresh union at the same precision, merges the sketch once, 
and drops the union. The source is reused across rounds. Times are five-run 
medians with the full range, alternating the two revisions on an Apple M4 Max 
running macOS 26.6.2 and rustc 1.101.0-nightly (`8006091eb`). The baseline is 
`6d8b342` with the same benchmark added.
   
   | lg_k | Fixed rounds | Baseline, ms (range) | 7b5ca83, ms (range) | 
Temporary memory saved |
   | ---: | -----------: | -------------------: | ------------------: | 
---------------------: |
   |   11 |      230,000 |        299 (298–316) |       106 (103–127) |         
        16 KiB |
   |   14 |       26,000 |        307 (302–313) |       132 (131–135) |         
       128 KiB |
   
   ```shell
   cargo x bench -- cpc::union::empty_from_sliding --repeat 5 --raw
   ```
   
   `cargo x check`, `cargo x test`, `cargo x lint`, and the new benchmark's 
smoke run passed.
   


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