tisonkun commented on PR #343:
URL: 
https://github.com/apache/datasketches-rust/pull/343#issuecomment-6795366039

   ## Benchmark Comparison: `main` (`c344dad`) vs PR `HEAD` (`9f35b6f`)
   
   Measured on Apple M4 Max (macOS, `rustc 1.98.0`, `--release`). Both 
revisions are compiled under identical optimization settings and executed in 
the same process across 7 interleaved, order-rotated repetitions at fixed round 
counts, with 50% key overlap (`A = [0, n)`, `B = [n/2, 3n/2)`) unless noted 
otherwise.
   
   ### Summary
   
   - **Unordered compact `A` and `B` (`FoldHashState` vs `SipHash`)**: 
**1.52x–2.24x faster** across exact and estimation cardinalities, isolating the 
gain from replacing `RandomState` (`SipHash-1-3`) with `FoldHashState` seeded 
from the thread-local `SplitMix64` stream.
   - **Mutable `A` and `B` (direct `SketchHashTable` probing)**: **1.97x–4.22x 
faster** for `ThetaANotB` and **1.98x–5.40x faster** for `TupleANotB` on 
symmetric inputs, because probing mutable `B` directly eliminates scanning `B` 
and allocating/populating a temporary `HashSet`.
   - **Asymmetric and mixed inputs**: **40.1x faster** when subtracting a 
sampled mutable `B` (`n = 65,536`) from an ordered exact `A` (`n = 4,096`) via 
combined early-stop on `A` and direct probing on `B`, and **200x–2,660x 
faster** when subtracting a large mutable `B` from a small `A` (`O(|A|)` vs 
`O(|A| + |B|)`).
   - **Ordered compact `A` and `B` (control)**: **0.99x** (`177.4 ms` vs `179.2 
ms`), confirming no regression on the sorted merge-scan path.
   
   ### 1. `ThetaANotB` — Unordered Compact `A` & `B` (`FoldHashState` vs 
`SipHash`)
   
   | Scenario                                                   |  Rounds | 
`main` median (min..max) | PR `HEAD` median (min..max) | PR / `main` |   
Speedup |
   | :--------------------------------------------------------- | ------: | 
-----------------------: | --------------------------: | ----------: | 
--------: |
   | `theta::compact_unordered::unordered_out/n=64,lg_k=12`     | 200,000 |   
161.7 ms (160..171 ms) |      102.4 ms (101..103 ms) |       0.63x | **1.58x** |
   | `theta::compact_unordered::ordered_out/n=64,lg_k=12`       | 200,000 |   
173.3 ms (172..175 ms) |      113.7 ms (113..114 ms) |       0.66x | **1.52x** |
   | `theta::compact_unordered::unordered_out/n=1024,lg_k=12`   |  20,000 |   
248.6 ms (247..260 ms) |      120.7 ms (119..121 ms) |       0.49x | **2.06x** |
   | `theta::compact_unordered::ordered_out/n=1024,lg_k=12`     |  20,000 |   
285.6 ms (283..293 ms) |      157.6 ms (155..159 ms) |       0.55x | **1.81x** |
   | `theta::compact_unordered::unordered_out/n=65536,lg_k=12`  |   2,000 |   
176.6 ms (175..178 ms) |         95.3 ms (94..95 ms) |       0.54x | **1.85x** |
   | `theta::compact_unordered::ordered_out/n=65536,lg_k=12`    |   2,000 |   
200.0 ms (198..201 ms) |      118.6 ms (117..119 ms) |       0.59x | **1.69x** |
   | `theta::compact_unordered::unordered_out/n=262144,lg_k=16` |     200 |   
282.3 ms (280..288 ms) |      160.1 ms (159..160 ms) |       0.57x | **1.76x** |
   | `theta::compact_unordered::ordered_out/n=262144,lg_k=16`   |     100 |   
164.5 ms (163..166 ms) |      103.6 ms (102..106 ms) |       0.63x | **1.59x** |
   
   ### 2. `ThetaANotB` — Mutable `A` & `B` (Direct `SketchHashTable` Probing)
   
   | Scenario                                         |  Rounds | `main` median 
(min..max) | PR `HEAD` median (min..max) | PR / `main` |   Speedup |
   | :----------------------------------------------- | ------: | 
-----------------------: | --------------------------: | ----------: | 
--------: |
   | `theta::mutable::unordered_out/n=64,lg_k=12`     | 200,000 |   168.9 ms 
(166..169 ms) |         51.5 ms (50..53 ms) |       0.30x | **3.28x** |
   | `theta::mutable::ordered_out/n=64,lg_k=12`       | 200,000 |   180.8 ms 
(179..182 ms) |         63.2 ms (62..64 ms) |       0.35x | **2.86x** |
   | `theta::mutable::unordered_out/n=1024,lg_k=12`   |  20,000 |   299.8 ms 
(298..309 ms) |         91.3 ms (90..93 ms) |       0.30x | **3.28x** |
   | `theta::mutable::ordered_out/n=1024,lg_k=12`     |  10,000 |   169.6 ms 
(168..170 ms) |         64.1 ms (63..64 ms) |       0.38x | **2.65x** |
   | `theta::mutable::unordered_out/n=65536,lg_k=12`  |   2,000 |   171.4 ms 
(170..178 ms) |         40.7 ms (39..43 ms) |       0.24x | **4.22x** |
   | `theta::mutable::ordered_out/n=65536,lg_k=12`    |   2,000 |   195.9 ms 
(193..198 ms) |         63.1 ms (60..70 ms) |       0.32x | **3.10x** |
   | `theta::mutable::unordered_out/n=262144,lg_k=16` |     100 |   176.9 ms 
(173..180 ms) |         81.6 ms (79..83 ms) |       0.46x | **2.17x** |
   | `theta::mutable::ordered_out/n=262144,lg_k=16`   |     100 |   204.0 ms 
(201..205 ms) |      103.6 ms (100..106 ms) |       0.51x | **1.97x** |
   
   ### 3. `ThetaANotB` — Asymmetric, Mixed & Ordered Control Workloads
   
   | Scenario                                                       | Rounds |  
`main` median (min..max) | PR `HEAD` median (min..max) | PR / `main` |      
Speedup |
   | :------------------------------------------------------------- | -----: | 
------------------------: | --------------------------: | ----------: | 
-----------: |
   | `theta::small_a_mutable_b::ordered_out/a=64,b=65536(lg_k=12)`  | 20,000 |  
  723.0 ms (721..749 ms) |     3.57 ms (3.50..3.73 ms) |      0.005x |   
**202.4x** |
   | `theta::small_a_mutable_b::ordered_out/a=64,b=262144(lg_k=16)` |  2,000 | 
1343.8 ms (1337..1351 ms) |     0.50 ms (0.48..0.56 ms) |     0.0004x | 
**2,662.1x** |
   | `theta::ordered_a_mutable_b::ordered_out/a=4096,b=65536`       | 20,000 |  
  795.3 ms (793..798 ms) |  19.85 ms (19.35..19.90 ms) |      0.025x |    
**40.1x** |
   | `theta::compact_ordered::ordered_out/n=65536,lg_k=12`          | 10,000 |  
  177.4 ms (176..186 ms) |      179.2 ms (176..198 ms) |       1.01x |    
**0.99x** |
   
   ### 4. `TupleANotB` (`u64` Summary) — Unordered Compact & Mutable Workloads
   
   | Scenario                                                   | Rounds | 
`main` median (min..max) | PR `HEAD` median (min..max) | PR / `main` |   
Speedup |
   | :--------------------------------------------------------- | -----: | 
-----------------------: | --------------------------: | ----------: | 
--------: |
   | `tuple::compact_unordered::unordered_out/n=1024,lg_k=12`   | 20,000 |   
230.7 ms (229..233 ms) |      102.9 ms (101..111 ms) |       0.45x | **2.24x** |
   | `tuple::compact_unordered::ordered_out/n=1024,lg_k=12`     | 20,000 |   
278.9 ms (277..282 ms) |      151.9 ms (149..161 ms) |       0.54x | **1.84x** |
   | `tuple::mutable::unordered_out/n=1024,lg_k=12`             | 20,000 |   
286.0 ms (285..290 ms) |         80.0 ms (79..80 ms) |       0.28x | **3.57x** |
   | `tuple::mutable::ordered_out/n=1024,lg_k=12`               | 10,000 |   
167.0 ms (165..173 ms) |         64.4 ms (63..65 ms) |       0.39x | **2.59x** |
   | `tuple::compact_unordered::unordered_out/n=65536,lg_k=12`  |  2,000 |   
163.3 ms (161..165 ms) |         83.5 ms (82..84 ms) |       0.51x | **1.96x** |
   | `tuple::compact_unordered::ordered_out/n=65536,lg_k=12`    |  2,000 |   
193.8 ms (192..196 ms) |      118.7 ms (117..121 ms) |       0.61x | **1.63x** |
   | `tuple::mutable::unordered_out/n=65536,lg_k=12`            |  2,000 |   
165.2 ms (164..167 ms) |         30.6 ms (30..30 ms) |       0.19x | **5.40x** |
   | `tuple::mutable::ordered_out/n=65536,lg_k=12`              |  2,000 |   
195.5 ms (193..196 ms) |         60.6 ms (59..61 ms) |       0.31x | **3.23x** |
   | `tuple::compact_unordered::unordered_out/n=262144,lg_k=16` |    200 |   
264.8 ms (262..269 ms) |      144.1 ms (141..145 ms) |       0.54x | **1.84x** |
   | `tuple::compact_unordered::ordered_out/n=262144,lg_k=16`   |    100 |   
163.6 ms (160..165 ms) |      101.9 ms (100..102 ms) |       0.62x | **1.61x** |
   | `tuple::mutable::unordered_out/n=262144,lg_k=16`           |    100 |   
172.5 ms (171..173 ms) |         76.8 ms (70..80 ms) |       0.45x | **2.25x** |
   | `tuple::mutable::ordered_out/n=262144,lg_k=16`             |    100 |   
210.3 ms (208..227 ms) |      106.3 ms (101..109 ms) |       0.51x | **1.98x** |
   


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