This is an automated email from the ASF dual-hosted git repository.
tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
The following commit(s) were added to refs/heads/main by this push:
new bb6ba57 perf(xor): reduce peak construction memory (#316)
bb6ba57 is described below
commit bb6ba571e6e24a0b64365a2ef5825b4db18b1eff
Author: tison <[email protected]>
AuthorDate: Fri Oct 30 18:09:34 2026 +0800
perf(xor): reduce peak construction memory (#316)
---
CHANGELOG.md | 2 +-
datasketches/src/xor/filter.rs | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 376478f..cbc6000 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ All significant changes to this project will be documented in
this file.
### New features
-* Add immutable `XorFilter` and `XorFilterBuilder` behind the `xor` feature,
with 8-, 16-, and 32-bit fingerprints, consuming builder configuration with
complete-input construction and bounded seeded retries, optional cardinality
metadata for imported filters, standard serialization for all three widths
(Java-compatible for 8/16-bit filters), and raw parts for application-defined
storage.
+* Add immutable `XorFilter` and `XorFilterBuilder` behind the `xor` feature,
with 8-, 16-, and 32-bit fingerprints, consuming builder configuration with
complete-input construction, bounded seeded retries and compact temporary
storage, optional cardinality metadata for imported filters, standard
serialization for all three widths (Java-compatible for 8/16-bit filters), and
raw parts for application-defined storage.
### Improvements
diff --git a/datasketches/src/xor/filter.rs b/datasketches/src/xor/filter.rs
index 0762b40..0bf297b 100644
--- a/datasketches/src/xor/filter.rs
+++ b/datasketches/src/xor/filter.rs
@@ -405,6 +405,12 @@ impl XorFilter {
.with_context("num_items", num_items));
}
+ // Assignment only needs the peel stack. Release the graph before
allocating the
+ // fingerprint payload so these allocations do not overlap at peak
memory usage.
+ drop(xor_mask);
+ drop(count);
+ drop(queue);
+
let fingerprints = match filter_type {
XorFilterType::Xor8 => {
let mut values = vec![0_u8; capacity].into_boxed_slice();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]