Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions encodings/alp/benches/alp_compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use vortex_array::dtype::NativePType;
use vortex_array::memory::MemorySession;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::session::ArraySession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_buffer::buffer;
Expand Down Expand Up @@ -100,6 +101,7 @@ fn compress_alp<T: ALPFloat + NativePType>(bencher: Bencher, args: (usize, f64,
};
let values = values.freeze();
let array = PrimitiveArray::new(values, validity);
mark_optimized(array.as_array(), &SESSION).unwrap();

bencher
.with_inputs(|| (&array, SESSION.create_execution_ctx()))
Expand All @@ -126,15 +128,15 @@ fn decompress_alp<T: ALPFloat + NativePType>(bencher: Bencher, args: (usize, f64
let values = values.freeze();
bencher
.with_inputs(|| {
(
alp_encode(
PrimitiveArray::new(Buffer::copy_from(&values), validity.clone()).as_view(),
None,
&mut SESSION.create_execution_ctx(),
)
.unwrap(),
SESSION.create_execution_ctx(),
let encoded = alp_encode(
PrimitiveArray::new(Buffer::copy_from(&values), validity.clone()).as_view(),
None,
&mut SESSION.create_execution_ctx(),
)
.unwrap();
mark_optimized(encoded.as_array(), &SESSION).unwrap();

(encoded, SESSION.create_execution_ctx())
})
.bench_values(|(v, mut ctx)| decompress_into_array(v, &mut ctx));
}
Expand Down Expand Up @@ -179,6 +181,8 @@ fn make_rd_array<T: ALPRDFloat + NativePType>(n: usize, fraction_patch: f64) ->
fn compress_rd<T: ALPRDFloat + NativePType>(bencher: Bencher, args: (usize, f64)) {
let (n, fraction_patch) = args;
let primitive = make_rd_array::<T>(n, fraction_patch);
mark_optimized(primitive.as_array(), &SESSION).unwrap();

let encoder = RDEncoder::new(primitive.as_slice::<T>());

bencher
Expand All @@ -192,6 +196,7 @@ fn decompress_rd<T: ALPRDFloat + NativePType>(bencher: Bencher, args: (usize, f6
let primitive = make_rd_array::<T>(n, fraction_patch);
let encoder = RDEncoder::new(primitive.as_slice::<T>());
let encoded = encoder.encode(primitive.as_view());
mark_optimized(encoded.as_array(), &SESSION).unwrap();

bencher
.with_inputs(|| (&encoded, SESSION.create_execution_ctx()))
Expand Down
3 changes: 3 additions & 0 deletions encodings/datetime-parts/benches/split_temporal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use vortex_array::arrays::PrimitiveArray;
use vortex_array::arrays::TemporalArray;
use vortex_array::extension::datetime::TimeUnit;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_datetime_parts::split_temporal;
Expand Down Expand Up @@ -58,6 +59,7 @@ fn split(bencher: Bencher, args: (usize, TimeUnit)) {
unit,
Some("UTC".into()),
);
mark_optimized(array.temporal_values(), &SESSION).unwrap();

bencher
.with_inputs(|| (array.clone(), SESSION.create_execution_ctx()))
Expand All @@ -80,6 +82,7 @@ fn split_extreme(bencher: Bencher, args: (usize, TimeUnit)) {
unit,
Some("UTC".into()),
);
mark_optimized(array.temporal_values(), &SESSION).unwrap();

bencher
.with_inputs(|| (array.clone(), SESSION.create_execution_ctx()))
Expand Down
6 changes: 6 additions & 0 deletions encodings/decimal-byte-parts/benches/dbp_assemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ mod arrays {
use vortex_array::dtype::DecimalDType;
use vortex_array::dtype::DecimalType;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::buffer;
use vortex_decimal_byte_parts::_benchmarking::assemble_decimal;
Expand Down Expand Up @@ -170,6 +171,11 @@ mod arrays {
lower_parts: Vec<ArrayRef>,
decimal_dtype: DecimalDType,
) {
mark_optimized(&msp, &SESSION).vortex_expect("mark the MSP as optimized");
for part in &lower_parts {
mark_optimized(part, &SESSION).vortex_expect("mark the lower part as optimized");
}

bencher
.with_inputs(|| SESSION.create_execution_ctx())
.bench_refs(|ctx| {
Expand Down
10 changes: 8 additions & 2 deletions encodings/decimal-byte-parts/benches/dbp_compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use vortex_array::dtype::PType;
use vortex_array::scalar::DecimalValue;
use vortex_array::scalar::Scalar;
use vortex_array::scalar_fn::fns::operators::Operator;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::BitBuffer;
use vortex_buffer::Buffer;
Expand Down Expand Up @@ -219,9 +220,12 @@ impl Input {
.map_or(Validity::NonNullable, Validity::from);
let msp =
PrimitiveArray::from_byte_buffer(self.msp_values.clone(), self.msp_ptype, validity);
DecimalByteParts::try_new(msp.into_array(), self.decimal_dtype)
let array = DecimalByteParts::try_new(msp.into_array(), self.decimal_dtype)
.vortex_expect("the MSP of every benchmark input is a signed integer array")
.into_array()
.into_array();
mark_optimized(&array, &SESSION).vortex_expect("mark the benchmark input as optimized");

array
}
}

Expand Down Expand Up @@ -257,6 +261,8 @@ fn decode(bencher: Bencher, case: Case) {
/// Compares a new array of `case` with `Gte` against a constant of `value` in each iteration.
fn bench_compare(bencher: Bencher, case: Case, value: DecimalValue) {
let constant = case.constant(value);
mark_optimized(&constant, &SESSION).vortex_expect("mark the constant as optimized");

bench_case(bencher, case, |array, ctx| {
array
.binary(constant.clone(), Operator::Gte)
Expand Down
3 changes: 3 additions & 0 deletions encodings/decimal-byte-parts/benches/dbp_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ mod arrays {
use vortex_array::VortexSessionExecute;
use vortex_array::dtype::DecimalType;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_decimal_byte_parts::split_decimal;
use vortex_error::VortexExpect;
Expand Down Expand Up @@ -116,6 +117,8 @@ mod arrays {

fn bench_split(bencher: Bencher, values_type: DecimalType, len: usize, validity: Validity) {
let decimal = decimal_array(values_type, len, validity);
mark_optimized(decimal.as_array(), &SESSION).vortex_expect("mark the decimal as optimized");

bencher
.with_inputs(|| SESSION.create_execution_ctx())
.bench_refs(|ctx| {
Expand Down
16 changes: 10 additions & 6 deletions encodings/elias-fano/benches/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use vortex_array::IntoArray;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::Primitive;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_elias_fano::unary_encode;
Expand Down Expand Up @@ -106,13 +107,16 @@ fn primitive(shape: Shape) -> PrimitiveArray {
}

fn encoded(shape: Shape) -> ArrayRef {
unary_encode(
let array = unary_encode(
primitive(shape).as_ref().as_::<Primitive>(),
&mut SESSION.create_execution_ctx(),
)
.unwrap()
.unwrap()
.into_array()
.into_array();
mark_optimized(&array, &SESSION).unwrap();

array
}

#[divan::bench(args = SHAPES)]
Expand All @@ -121,10 +125,10 @@ fn encode(bencher: Bencher, shape: Shape) {
// A fresh array each time, so `sum` cannot reuse the statistic cached on the last one.
bencher
.with_inputs(|| {
(
PrimitiveArray::new(values.clone(), Validity::NonNullable),
SESSION.create_execution_ctx(),
)
let array = PrimitiveArray::new(values.clone(), Validity::NonNullable);
mark_optimized(array.as_array(), &SESSION).unwrap();

(array, SESSION.create_execution_ctx())
})
.bench_local_values(|(array, mut ctx)| {
divan::black_box(unary_encode(array.as_ref().as_::<Primitive>(), &mut ctx).unwrap());
Expand Down
2 changes: 2 additions & 0 deletions encodings/fastlanes/benches/bitpack_blocked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use vortex_array::aggregate_fn::session::AggregateFnSession;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::session::ArraySession;
use vortex_array::test_harness::mark_optimized;
use vortex_fastlanes::bitpack_compress::bitpack_encode_blocked;
use vortex_session::VortexSession;

Expand Down Expand Up @@ -54,6 +55,7 @@ fn bitpack_blocked_compress(bencher: Bencher) {
let array = PrimitiveArray::from_iter(bit_widths.iter().flat_map(|&bit_width| {
(0..1024u32).map(move |i| i.wrapping_mul(7919) & ((1 << bit_width) - 1))
}));
mark_optimized(array.as_array(), &SESSION).unwrap();

bencher.counter(ItemsCount::new(array.len())).bench(|| {
bitpack_encode_blocked(
Expand Down
3 changes: 3 additions & 0 deletions encodings/fastlanes/benches/bitpack_blocked_decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use vortex_array::dtype::NativePType;
use vortex_array::memory::MemorySession;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::session::ArraySession;
use vortex_array::test_harness::mark_optimized;
use vortex_fastlanes::BitPackedArraySlotsExt;
use vortex_fastlanes::bitpack_compress::bitpack_encode_blocked;
use vortex_fastlanes::bitpack_decompress::unpack_array_blocked;
Expand Down Expand Up @@ -64,6 +65,8 @@ where
&mut SESSION.create_execution_ctx(),
)
.unwrap();
mark_optimized(array.as_array(), &SESSION).unwrap();

let offsets = array.block_offsets().unwrap().clone();

bencher.counter(ItemsCount::new(array.len())).bench(|| {
Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/bitpack_compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use vortex_array::memory::MemorySession;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::scalar_fn::fns::operators::Operator;
use vortex_array::session::ArraySession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::Alignment;
use vortex_buffer::BufferMut;
Expand Down Expand Up @@ -98,6 +99,9 @@ fn build_inputs() -> (ArrayRef, ArrayRef, ExecutionCtx) {
// 1 << BW is just past the packable range, so the out-of-range fast path fires.
let constant = 1u32 << BW;
let rhs = ConstantArray::new(constant, LEN).into_array();
mark_optimized(&array, &SESSION).unwrap();
mark_optimized(&rhs, &SESSION).unwrap();

(array, rhs, ctx)
}

Expand Down
4 changes: 4 additions & 0 deletions encodings/fastlanes/benches/bitpack_compare_sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::scalar::Scalar;
use vortex_array::scalar_fn::fns::operators::Operator;
use vortex_array::session::ArraySession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::Alignment;
use vortex_buffer::BufferMut;
Expand Down Expand Up @@ -141,6 +142,9 @@ fn setup<T: BenchInt>(width: usize) -> (ArrayRef, ArrayRef, ExecutionCtx) {
)
.into_array();
let rhs = ConstantArray::new(T::from_counter(cap / 2), LEN).into_array();
mark_optimized(&array, &SESSION).unwrap();
mark_optimized(&rhs, &SESSION).unwrap();

(array, rhs, ctx)
}

Expand Down
2 changes: 2 additions & 0 deletions encodings/fastlanes/benches/bitpacking_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use vortex_array::aggregate_fn::session::AggregateFnSession;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::optimizer::kernels::KernelSession;
use vortex_array::session::ArraySession;
use vortex_array::test_harness::mark_optimized;
use vortex_array::validity::Validity;
use vortex_buffer::BufferMut;
use vortex_fastlanes::BitPackedData;
Expand Down Expand Up @@ -61,6 +62,7 @@ fn fixture(selected_per_chunk: usize) -> (ArrayRef, Mask) {
)
.unwrap()
.into_array();
mark_optimized(&packed, &SESSION).unwrap();

let indices = (0..NUM_SELECTED_CHUNKS).flat_map(|chunk| {
(0..selected_per_chunk)
Expand Down
Loading
Loading