@@ -12,6 +12,7 @@ use vortex_buffer::Buffer;
1212use vortex_mask:: MaskValues ;
1313
1414use crate :: arrays:: filter:: execute:: byte_compress;
15+ use crate :: arrays:: filter:: execute:: simd_compress;
1516use crate :: arrays:: filter:: execute:: slice;
1617
1718const CACHED_INDICES_MAX_DENSITY : f64 = 0.5 ;
@@ -21,8 +22,8 @@ const MIN_SLICES_AVERAGE_RUN_LENGTH: usize = 8;
2122/// Filter a [`Buffer<T>`] by [`MaskValues`], returning a new buffer.
2223///
2324/// Dense uniquely owned buffers are compacted in place. Shared and sparse buffers allocate an
24- /// exact-sized output and choose between cached indices, cached long ranges, bitmap iteration ,
25- /// and byte-compress based on the mask and element width.
25+ /// exact-sized output and choose between cached indices, cached long ranges, SIMD compress ,
26+ /// bitmap iteration, and byte-compress based on the mask, element width, and CPU features .
2627pub ( super ) fn filter_buffer < T : Copy > ( buffer : Buffer < T > , mask : & MaskValues ) -> Buffer < T > {
2728 assert_eq ! ( buffer. len( ) , mask. len( ) ) ;
2829
@@ -53,6 +54,10 @@ fn filter_slice<T: Copy>(values: &[T], mask: &MaskValues) -> Buffer<T> {
5354 return slice:: filter_slice_by_indices ( values, indices) ;
5455 }
5556
57+ if let Some ( filtered) = simd_compress:: filter_slice_by_bitmap ( values, mask) {
58+ return filtered;
59+ }
60+
5661 if mask. density ( ) >= byte_compress_density_threshold :: < T > ( ) {
5762 byte_compress:: filter_buffer ( values, mask)
5863 } else {
@@ -71,6 +76,10 @@ fn filter_slice_in_place<T: Copy>(values: &mut [T], mask: &MaskValues) -> usize
7176 return slice:: filter_slice_mut_by_indices ( values, indices) ;
7277 }
7378
79+ if let Some ( new_len) = simd_compress:: filter_slice_mut_by_bitmap ( values, mask) {
80+ return new_len;
81+ }
82+
7483 slice:: filter_slice_mut_by_bitmap ( values, mask)
7584}
7685
0 commit comments