This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new f8d957287e Change `BooleanBuffer::append_packed_range` to use
`apply_bitwise_binary_op` (#8812)
f8d957287e is described below
commit f8d957287e59b65f23718f0c2eb67f621d21ac43
Author: Andrew Lamb <[email protected]>
AuthorDate: Thu Nov 13 07:16:24 2025 -0500
Change `BooleanBuffer::append_packed_range` to use
`apply_bitwise_binary_op` (#8812)
# Which issue does this PR close?
- related to https://github.com/apache/arrow-rs/issues/8561
# Rationale for this change
We added an optimized packed implementation in the following PR:
- https://github.com/apache/arrow-rs/pull/8619
Let's use it to make append_packed_range faster
# What changes are included in this PR?
- Use `apply_bitwise_binary_op`
# Are these changes tested?
Functionally by CI
I will also run benchmarks for this PR
# Are there any user-facing changes?
Faster peformance
---
arrow-buffer/src/builder/boolean.rs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arrow-buffer/src/builder/boolean.rs
b/arrow-buffer/src/builder/boolean.rs
index 4ca91d1d73..512f729fda 100644
--- a/arrow-buffer/src/builder/boolean.rs
+++ b/arrow-buffer/src/builder/boolean.rs
@@ -15,7 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-use crate::{BooleanBuffer, Buffer, MutableBuffer, bit_mask, bit_util};
+use crate::bit_util::apply_bitwise_binary_op;
+use crate::{BooleanBuffer, Buffer, MutableBuffer, bit_util};
use std::ops::Range;
/// Builder for [`BooleanBuffer`]
@@ -218,13 +219,16 @@ impl BooleanBufferBuilder {
pub fn append_packed_range(&mut self, range: Range<usize>, to_set: &[u8]) {
let offset_write = self.len;
let len = range.end - range.start;
+ // allocate new bits as 0
self.advance(len);
- bit_mask::set_bits(
+ // copy bits from to_set into self.buffer a word at a time
+ apply_bitwise_binary_op(
self.buffer.as_slice_mut(),
- to_set,
offset_write,
+ to_set,
range.start,
len,
+ |_a, b| b, // copy bits from to_set
);
}