tisonkun opened a new pull request, #209: URL: https://github.com/apache/datasketches-rust/pull/209
## Summary - add a Divan benchmark suite with allocation profiling for t-digest update, lifecycle, compression, merge, serialization, deserialization, and query paths - replace eager `k`-sized reservations with staged buffer growth so short-lived digests allocate in proportion to retained data - reuse the centroid vector during compression and merge, compact merged centroids in place, and hoist loop-invariant scale normalization - preserve stable centroid ordering and existing serialized-state behavior ## Benchmarks Measured with `cargo bench -p datasketches --features tdigest --bench tdigest` on an Apple M4 Max using Rust 1.86.0. Values are medians from release builds. | Benchmark | `main` | This PR | Change | | --- | ---: | ---: | ---: | | 1-value create/update/serialize/drop | 112.6 ns | 57.6 ns | -48.8% | | 8-value create/update/serialize/drop | 225.6 ns | 112.3 ns | -50.2% | | 64-value create/update/serialize/drop | 1.230 us | 896.9 ns | -27.1% | | Serialize 512 64-value partial states | 301.1 us | 151.6 us | -49.7% | | Deserialize 512 64-value partial states | 164.0 us | 118.0 us | -28.0% | | Merge 64 64-value partial states | 154.0 us | 96.1 us | -37.6% | Allocation profiler results for create/update/serialize/drop: | Values | `main` heap bytes | This PR heap bytes | Change | | ---: | ---: | ---: | ---: | | 1 | 19.77 KB | 96 B | -99.5% | | 8 | 20.09 KB | 352 B | -98.2% | | 64 | 22.78 KB | 3.10 KB | -86.4% | The fixed-size cases are synthetic stress points, not estimates of any production distribution. The 64-value update-only benchmark is approximately neutral; the lifecycle improvement comes from avoiding eager centroid allocation and reusing storage during compression and serialization. This implementation does not change centroid count or serialized bytes for equivalent inputs. The benchmark results therefore demonstrate local CPU and allocator improvements only, not reduced serialized payloads or end-to-end application latency. ## Validation - `cargo x check` - `cargo x test` - `cargo x lint` - `cargo bench -p datasketches --features tdigest --bench tdigest -- --test` -- 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]
