Skip to content

Commit 4711709

Browse files
committed
more
Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent ce6480f commit 4711709

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

vortex-array/src/arrays/filter/execute/byte_compress.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//! permutation table compacts the selected bytes in a single indexed copy,
88
//! avoiding the overhead of materializing indices or slices.
99
10+
use std::mem::size_of;
11+
1012
use vortex_buffer::Buffer;
1113
use vortex_buffer::BufferMut;
1214
use vortex_mask::MaskValues;
@@ -56,13 +58,15 @@ pub(super) fn filter_buffer<T: Copy>(buffer: Buffer<T>, mask: &MaskValues) -> Bu
5658
let mask_bytes = mask.bit_buffer().inner().as_ref();
5759
let mask_offset = mask.bit_buffer().offset();
5860

59-
// Fast path: no bit offset in the mask buffer and enough selected values to benefit from
60-
// scanning the bitmask directly.
61-
if mask_offset == 0 && mask.density() >= BYTE_COMPRESS_DENSITY_THRESHOLD {
61+
// Fast path: byte-wide values benefit from avoiding index materialization more often. Wider
62+
// values need enough selected values to justify scanning every mask byte directly.
63+
if mask_offset == 0
64+
&& (size_of::<T>() == 1 || mask.density() >= BYTE_COMPRESS_DENSITY_THRESHOLD)
65+
{
6266
return filter_aligned(src, mask_bytes, true_count);
6367
}
6468

65-
// Slow path: lower-density or unaligned masks are better handled by the generic path.
69+
// Slow path: lower-density wide values or unaligned masks are better handled by the generic path.
6670
super::slice::filter_slice_by_mask_values(src, mask)
6771
}
6872

0 commit comments

Comments
 (0)