Skip to content

Commit b0b812c

Browse files
authored
perf: Optimize Bitmap::make_mut (#23138)
1 parent 6e02c20 commit b0b812c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/polars-arrow/src/bitmap/immutable.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::bitmap::aligned::AlignedBitmapSlice;
1313
use crate::bitmap::iterator::{
1414
FastU32BitmapIter, FastU56BitmapIter, FastU64BitmapIter, TrueIdxIter,
1515
};
16+
use crate::bitmap::utils::bytes_for;
1617
use crate::legacy::utils::FromTrustedLenIterator;
1718
use crate::storage::SharedStorage;
1819
use crate::trusted_len::TrustedLen;
@@ -385,7 +386,8 @@ impl Bitmap {
385386
let vec = chunk_iter_to_vec(chunks.chain(std::iter::once(remainder)));
386387
MutableBitmap::from_vec(vec, data.length)
387388
} else {
388-
MutableBitmap::from_vec(data.storage.as_ref().to_vec(), data.length)
389+
let len = bytes_for(data.length);
390+
MutableBitmap::from_vec(data.storage[0..len].to_vec(), data.length)
389391
}
390392
},
391393
Either::Right(data) => data,

0 commit comments

Comments
 (0)