You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1fbff34
Browse filesBrowse the repository at this point in the historyBrowse files
Paul Meng
committed
docs: clarify digest contracts accuracy and memory costs
- Call `flush` before centroid queries, immutable merges, or serialization; `FromIterator<f64>` flushes before returning
43
+
-`Option<f64>` for queries that require samples (`min`, `max`, `mean`, `estimate_quantile`, `estimate_rank`, `trimmed_mean`); `quantiles` returns a vector of optional estimates
32
44
-`#[must_use]` on methods returning new values
33
45
-`#[non_exhaustive]` on public structs
34
-
-`debug_assert` for invariant checks (NaN rejection, min/max presence)
46
+
- Require a positive compression size in constructors; `max_size` is a compression target, not an exact byte budget
47
+
-`debug_assert` for ingestion contracts (finite values) and state invariants; these checks are absent in release builds
48
+
- Serde skips the pending buffer; never assume serialization flushes or rejects pending data
49
+
- Deserialization validates centroid order, weights, extrema, and count consistency; nonempty sums may be non-finite after valid ingestion
50
+
- Compression's final bucket absorbs remaining weight so count roundoff cannot exceed `max_size`
51
+
- Keep library code compatible with Rust 1.62 without `std`; verify this configuration separately from all-features builds
35
52
- No external dependencies by default; serde is behind the `serde` feature, with `use_serde` as a deprecated alias
36
53
- The library is `no_std` and uses `alloc`; the default `std` feature preserves existing behavior
To run this JSON example with exact finite-float round trips, add
195
+
`serde_json = { version = "1.0", features = ["float_roundtrip"] }` to your
196
+
dependencies. Without that feature, JSON parsing can introduce small rounding
197
+
differences in centroid values.
156
198
157
-
The `max_size` parameter controls the trade-off between accuracy and memory:
199
+
The pending ingestion buffer is omitted from serialization. Always call `flush`
200
+
after mutable ingestion: serializing without it succeeds but loses pending
201
+
samples while retaining their summary statistics. Deserialization validates
202
+
centroid ordering, weights, extrema, and count consistency, and rejects
203
+
inconsistent payloads such as an omitted buffer that leaves a count mismatch.
204
+
The 1.0 format uses `Option<f64>` for `min` and `max`; data written by older
205
+
versions may need migration, depending on the serialization format.
158
206
159
-
|`max_size`| Memory (approx.) | Accuracy |
160
-
|------------|-------------------|----------|
161
-
| 50 |~1.2 KB | Good for rough estimates |
162
-
| 100 |~2.4 KB | Good default |
163
-
| 200 |~4.8 KB | High accuracy |
164
-
| 500 |~12 KB | Very high accuracy |
207
+
## Compression factor
165
208
166
-
Larger values produce more centroids, giving better accuracy at the cost of more memory and slightly slower merges. A value of 100 is sufficient for most use cases.
209
+
The positive `max_size` parameter controls the trade-off between accuracy and
210
+
memory; zero is rejected. The default is 100.
211
+
212
+
|`max_size`| Centroid payload (approx.) | Full ingestion buffer |
0 commit comments