tisonkun opened a new pull request, #388: URL: https://github.com/apache/datasketches-rust/pull/388
CPC union folds a source row into the destination row with the same low `lg_k` bits. Both row counts are powers of two, and the destination has already adopted the smaller precision. Each destination-sized block of source rows therefore maps to one sequential pass over the destination. At equal precision there is exactly one block. Use this traversal for full coupon matrices and for Hybrid and Pinned window bytes. Those windows occupy columns 0 through 7 until the transition to Sliding, so their bytes can be ORed directly into the rows. Sliding inputs still need their full matrices to reconstruct earlier columns. This removes the per-row index mask and window shift without adding a precision or size dispatch. Related to #385. ### Benchmarks The first commit adds four scenarios and can be used as the baseline. The mixed workload merges four uneven partitions that produce Sparse, Hybrid, Pinned, and Sliding inputs. The serialized workload decodes four disjoint partials, merges them at `lg_k = 21`, and materializes and serializes the result. The two existing first-Sliding cases exercise the shortcut introduced in #387. Apple M4 Max, macOS 26.6.2, rustc 1.101.0-nightly (8006091eb). Each entry gives the median in milliseconds and the full range over nine pairs, alternating which revision ran first. Fixture construction and cleanup are included in each repetition. Round counts are identical between revisions. | Union workload | Rounds | cb48f58, ms | 0719b21, ms | | -------------------------------------- | ------: | --------------: | ---------------: | | Mixed partials, 11 into 11 | 100,000 | 294 (287–390) | 129 (128–134) | | Mixed partials, 14 into 11 | 11,000 | 295 (284–311) | 158 (156–168) | | Serialized, 4 × 4,096 keys, Sparse | 550 | 316 (303–747) | 308 (299–1,093) | | Serialized, 4 × 262,144 keys, Hybrid | 13 | 289 (283–396) | 261 (256–337) | | First Sliding input, 11 into 11 | 230,000 | 107 (106–164) | 107 (105–108) | | First Sliding input, 14 into 14 | 26,000 | 137 (133–200) | 137 (134–156) | Run the same workloads on each revision. ```sh cargo x bench -- cpc::union --repeat 9 --raw ``` ### Regression coverage The integration test compares the serialized result of folding a higher-precision Hybrid, Pinned, or Sliding source against a union built from the same keys directly at the destination precision. A separate differential run produced identical bytes for 640 unions across source flavors, input orders, and relative precisions. I also replayed the final aggregation stage on two one-million-row ClickBench partitions (`hits_0` and `hits_37`). Each was split into eight contiguous partials at `lg_k = 21`. Single-partial groups forward their bytes. Multi-partial groups deserialize, union, and reserialize before reading the estimate. All input partials were Sparse. All 78,644 group results and integer estimates matched across revisions. The largest upward movement in the nine-pair medians on rustc 1.102.0-nightly (5f4effd57) was Q8 on `hits_37`, from 324 to 328 ms. A second, 12-pair run measured 325 to 324 ms, with a same-binary control of 325 to 325 ms. Four heavily overlapping Hybrid partials on the same toolchain took 298 to 252 ms, including decoding, result encoding, and reading the estimate. Validation passed with `cargo x check`, `cargo x test`, `cargo x lint`, `cargo x bench -- cpc:: --test`, and an MSRV build check of the CPC feature. -- 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]
