Copilot commented on code in PR #190:
URL: https://github.com/apache/datasketches-rust/pull/190#discussion_r3744454724
##########
datasketches/tests/serde_tests/bloom.rs:
##########
@@ -19,6 +19,8 @@ use std::fs;
use std::path::PathBuf;
use datasketches::bloom::BloomFilter;
+use datasketches::bloom::BloomFilterBuilder;
+use datasketches::error::ErrorKind;
Review Comment:
`size_of` is used in the new slice ranges but isn’t imported or qualified,
so this test file won’t compile. Either import it from `std::mem` or qualify
the calls.
##########
datasketches/src/bloom/sketch.rs:
##########
@@ -477,17 +477,16 @@ impl BloomFilter {
.map_err(insufficient_data("bit_array"))?;
}
- // Handle "dirty" state: 0xFFFFFFFFFFFFFFFF indicates bits need
recounting
+ let counted_bits_set = bit_array.iter().map(|word|
word.count_ones() as u64).sum();
+
Review Comment:
`deserialize` currently makes two passes over the bit array: one to read it
and a second to compute the population count. You can compute the popcount
while reading each `u64` word to avoid the extra traversal (helps for large
filters and keeps the logic identical).
--
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]