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
143 changes: 115 additions & 28 deletions encodings/fastlanes/benches/bitpacking_take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use rand::distr::Uniform;
use rand::prelude::StdRng;
use vortex_array::Array;
use vortex_array::IntoArray as _;
use vortex_array::LEGACY_SESSION;
use vortex_array::RecursiveCanonical;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::compute::warm_up_vtables;
use vortex_array::validity::Validity;
Expand All @@ -31,8 +34,14 @@ fn take_10_stratified(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 10_000));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -43,8 +52,14 @@ fn take_10_contiguous(bencher: Bencher) {
let indices = buffer![0..10].into_array();

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -58,8 +73,14 @@ fn take_10k_random(bencher: Bencher) {
let indices = PrimitiveArray::from_iter(rng.sample_iter(range).take(10_000).map(|i| i as u32));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -70,8 +91,14 @@ fn take_10k_contiguous(bencher: Bencher) {
let indices = PrimitiveArray::from_iter(0..10_000);

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -82,8 +109,14 @@ fn take_200k_dispersed(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| (i * 42) % values.len() as u64));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -94,8 +127,14 @@ fn take_200k_first_chunk_only(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| ((i * 42) % 1024) as u64));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

fn fixture(len: usize, bits: usize) -> Buffer<u32> {
Expand Down Expand Up @@ -133,8 +172,14 @@ fn patched_take_10_stratified(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0..10).map(|i| i * 10_000));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -152,8 +197,14 @@ fn patched_take_10_contiguous(bencher: Bencher) {
let indices = buffer![0..10].into_array();

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -167,8 +218,14 @@ fn patched_take_10k_random(bencher: Bencher) {
let indices = PrimitiveArray::from_iter(rng.sample_iter(range).take(10_000).map(|i| i as u32));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -179,8 +236,14 @@ fn patched_take_10k_contiguous_not_patches(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0u32..NUM_EXCEPTIONS).cycle().take(10000));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -199,8 +262,14 @@ fn patched_take_10k_contiguous_patches(bencher: Bencher) {
PrimitiveArray::from_iter((BIG_BASE2..BIG_BASE2 + NUM_EXCEPTIONS).cycle().take(10000));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -211,8 +280,14 @@ fn patched_take_200k_dispersed(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| (i * 42) % values.len() as u64));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -223,8 +298,14 @@ fn patched_take_200k_first_chunk_only(bencher: Bencher) {
let indices = PrimitiveArray::from_iter((0..200_000).map(|i| ((i * 42) % 1024) as u64));

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}

#[divan::bench]
Expand All @@ -242,6 +323,12 @@ fn patched_take_10k_adversarial(bencher: Bencher) {
);

bencher
.with_inputs(|| (&packed, &indices))
.bench_refs(|(packed, indices)| packed.take(indices.to_array()).unwrap())
.with_inputs(|| (&packed, &indices, LEGACY_SESSION.create_execution_ctx()))
.bench_refs(|(packed, indices, execution_ctx)| {
packed
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
})
}
19 changes: 17 additions & 2 deletions encodings/runend/benches/run_end_compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use divan::Bencher;
use itertools::repeat_n;
use vortex_array::Array;
use vortex_array::IntoArray;
use vortex_array::LEGACY_SESSION;
use vortex_array::RecursiveCanonical;
use vortex_array::VortexSessionExecute;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::compute::warm_up_vtables;
use vortex_array::validity::Validity;
Expand Down Expand Up @@ -95,6 +98,18 @@ fn take_indices(bencher: Bencher, (length, run_step): (usize, usize)) {
.to_array();

bencher
.with_inputs(|| (&source_array, &runend_array))
.bench_refs(|(array, indices)| array.take(indices.to_array()).unwrap());
.with_inputs(|| {
(
&source_array,
&runend_array,
LEGACY_SESSION.create_execution_ctx(),
)
})
.bench_refs(|(array, indices, execution_ctx)| {
array
.take(indices.to_array())
.unwrap()
.execute::<RecursiveCanonical>(execution_ctx)
.unwrap()
});
}
Loading
Loading