Reduce memory allocations in PMMR (#3328)
We have a pattern in the code - return Vec, turn it into an iterator, filter and collect to another Vec. The idea was to return iterator where possible to avoid allocating intermediate vecs.
This commit is contained in:
@@ -279,8 +279,7 @@ impl PruneList {
|
||||
let maximum = self.bitmap.maximum().unwrap_or(0);
|
||||
self.pruned_cache = Bitmap::create_with_capacity(maximum);
|
||||
for pos in 1..(maximum + 1) {
|
||||
let path = path(pos as u64, maximum as u64);
|
||||
let pruned = path.into_iter().any(|x| self.bitmap.contains(x as u32));
|
||||
let pruned = path(pos as u64, maximum as u64).any(|x| self.bitmap.contains(x as u32));
|
||||
if pruned {
|
||||
self.pruned_cache.add(pos as u32)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user