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/fastlanes/benches/canonicalize_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ fn canonical_into_non_nullable(
chunked.dtype().nullability(),
chunk_len * chunk_count,
);
(chunked, primitive_builder)
(chunked, primitive_builder, SESSION.create_execution_ctx())
})
.bench_refs(|(chunked, primitive_builder)| {
.bench_refs(|(chunked, primitive_builder, ctx)| {
chunked
.append_to_builder(primitive_builder, &mut SESSION.create_execution_ctx())
.append_to_builder(primitive_builder, ctx)
.vortex_expect("append failed");
primitive_builder.finish()
});
Expand Down Expand Up @@ -114,8 +114,13 @@ fn into_canonical_nullable(
.collect::<Vec<_>>();

bencher
.with_inputs(|| ChunkedArray::from_iter(chunks.clone()).into_array())
.bench_values(|chunked| chunked.execute::<Canonical>(&mut SESSION.create_execution_ctx()));
.with_inputs(|| {
(
ChunkedArray::from_iter(chunks.clone()).into_array(),
SESSION.create_execution_ctx(),
)
})
.bench_values(|(chunked, mut ctx)| chunked.execute::<Canonical>(&mut ctx));
}

#[cfg(not(codspeed))]
Expand All @@ -140,11 +145,11 @@ fn canonical_into_nullable(
chunked.dtype().nullability(),
chunk_len * chunk_count,
);
(chunked, primitive_builder)
(chunked, primitive_builder, SESSION.create_execution_ctx())
})
.bench_refs(|(chunked, primitive_builder)| {
.bench_refs(|(chunked, primitive_builder, ctx)| {
chunked
.append_to_builder(primitive_builder, &mut SESSION.create_execution_ctx())
.append_to_builder(primitive_builder, ctx)
.vortex_expect("append failed");
primitive_builder.finish()
});
Expand Down
16 changes: 9 additions & 7 deletions encodings/fsst/benches/chunked_dict_fsst_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ fn chunked_dict_fsst_canonical_into(
) {
let chunk = make_dict_fsst_chunks::<u16>(len, unique_values, chunk_count);

bencher.with_inputs(|| &chunk).bench_refs(|chunk| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunk, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), ctx)
.vortex_expect("append failed");
builder.finish()
})
}

#[divan::bench(args = BENCH_ARGS)]
Expand Down
16 changes: 9 additions & 7 deletions encodings/fsst/benches/fsst_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ fn bench_like(bencher: Bencher, fsst: &FSSTArray, pattern: &str) {
let len = fsst.len();
let arr = fsst.clone().into_array();
let pattern = ConstantArray::new(pattern, len).into_array();
bencher.bench_local(|| {
Like.try_new_array(len, LikeOptions::default(), [arr.clone(), pattern.clone()])
.unwrap()
.into_array()
.execute::<Canonical>(&mut SESSION.create_execution_ctx())
.unwrap()
});
bencher
.with_inputs(|| SESSION.create_execution_ctx())
.bench_refs(|ctx| {
Like.try_new_array(len, LikeOptions::default(), [arr.clone(), pattern.clone()])
.unwrap()
.into_array()
.execute::<Canonical>(ctx)
.unwrap()
});
}

#[divan::bench(args = [
Expand Down
108 changes: 60 additions & 48 deletions vortex-array/benches/chunk_array_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,30 @@ static SESSION: LazyLock<VortexSession> =
fn chunked_bool_canonical_into(bencher: Bencher, (len, chunk_count): (usize, usize)) {
let chunk = make_bool_chunks(len, chunk_count);

bencher.with_inputs(|| &chunk).bench_refs(|chunk| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunk, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), ctx)
.vortex_expect("append failed");
builder.finish()
})
}

#[divan::bench(args = BENCH_ARGS)]
fn chunked_opt_bool_canonical_into(bencher: Bencher, (len, chunk_count): (usize, usize)) {
let chunk = make_opt_bool_chunks(len, chunk_count);

bencher.with_inputs(|| &chunk).bench_refs(|chunk| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunk, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), ctx)
.vortex_expect("append failed");
builder.finish()
})
}

#[divan::bench(args = BENCH_ARGS)]
Expand All @@ -74,16 +78,18 @@ fn chunked_opt_bool_into_canonical(bencher: Bencher, (len, chunk_count): (usize,
fn chunked_varbinview_canonical_into(bencher: Bencher, (len, chunk_count): (usize, usize)) {
let chunks = make_string_chunks(false, len, chunk_count);

bencher.with_inputs(|| &chunks).bench_refs(|chunk| {
let mut builder = VarBinViewBuilder::with_capacity(
DType::Utf8(chunk.dtype().nullability()),
len * chunk_count,
);
chunk
.append_to_builder(&mut builder, &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunks, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = VarBinViewBuilder::with_capacity(
DType::Utf8(chunk.dtype().nullability()),
len * chunk_count,
);
chunk
.append_to_builder(&mut builder, ctx)
.vortex_expect("append failed");
builder.finish()
})
}

#[divan::bench(args = BENCH_ARGS)]
Expand All @@ -99,16 +105,18 @@ fn chunked_varbinview_into_canonical(bencher: Bencher, (len, chunk_count): (usiz
fn chunked_varbinview_opt_canonical_into(bencher: Bencher, (len, chunk_count): (usize, usize)) {
let chunks = make_string_chunks(true, len, chunk_count);

bencher.with_inputs(|| &chunks).bench_refs(|chunk| {
let mut builder = VarBinViewBuilder::with_capacity(
DType::Utf8(chunk.dtype().nullability()),
len * chunk_count,
);
chunk
.append_to_builder(&mut builder, &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunks, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = VarBinViewBuilder::with_capacity(
DType::Utf8(chunk.dtype().nullability()),
len * chunk_count,
);
chunk
.append_to_builder(&mut builder, ctx)
.vortex_expect("append failed");
builder.finish()
})
}

#[divan::bench(args = BENCH_ARGS)]
Expand All @@ -124,13 +132,15 @@ fn chunked_varbinview_opt_into_canonical(bencher: Bencher, (len, chunk_count): (
fn chunked_constant_i32_append_to_builder(bencher: Bencher, (len, chunk_count): (usize, usize)) {
let chunk = make_constant_i32_chunks(len, chunk_count);

bencher.with_inputs(|| &chunk).bench_refs(|chunk| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunk, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), ctx)
.vortex_expect("append failed");
builder.finish()
})
}

const CONSTANT_UTF8_BENCH_ARGS: &[(&str, usize, usize)] = &[
Expand All @@ -146,13 +156,15 @@ fn chunked_constant_utf8_append_to_builder(
) {
let chunk = make_constant_utf8_chunks(value, len, chunk_count);

bencher.with_inputs(|| &chunk).bench_refs(|chunk| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunk, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), ctx)
.vortex_expect("append failed");
builder.finish()
})
}

fn make_constant_utf8_chunks(value: &str, len: usize, chunk_count: usize) -> ArrayRef {
Expand Down
20 changes: 11 additions & 9 deletions vortex-array/benches/chunked_dict_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ fn chunked_dict_primitive_canonical_into<T: NativePType>(
{
let chunk = gen_dict_primitive_chunks::<T, u16>(len, unique_values, chunk_count);

bencher.with_inputs(|| &chunk).bench_refs(|chunk| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), &mut SESSION.create_execution_ctx())
.vortex_expect("append failed");
builder.finish()
})
bencher
.with_inputs(|| (&chunk, SESSION.create_execution_ctx()))
.bench_refs(|(chunk, ctx)| {
let mut builder = builder_with_capacity(chunk.dtype(), len * chunk_count);
chunk
.append_to_builder(builder.as_mut(), ctx)
.vortex_expect("append failed");
builder.finish()
})
}

#[divan::bench(types = [u32, u64, f32, f64], args = BENCH_ARGS)]
Expand All @@ -59,6 +61,6 @@ fn chunked_dict_primitive_into_canonical<T: NativePType>(
let chunk = gen_dict_primitive_chunks::<T, u16>(len, unique_values, chunk_count);

bencher
.with_inputs(|| chunk.clone())
.bench_values(|chunk| chunk.execute::<Canonical>(&mut SESSION.create_execution_ctx()))
.with_inputs(|| (chunk.clone(), SESSION.create_execution_ctx()))
.bench_values(|(chunk, mut ctx)| chunk.execute::<Canonical>(&mut ctx))
}
7 changes: 3 additions & 4 deletions vortex-array/benches/dict_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ fn bench_dict_mask(bencher: Bencher, (fraction_valid, fraction_masked): (f64, f6
let filter_mask = filter_mask(len, fraction_masked, &mut rng);
let session = VortexSession::empty();
bencher
.with_inputs(|| (&array, &filter_mask))
.bench_refs(|(array, filter_mask)| {
let mut ctx = session.create_execution_ctx();
.with_inputs(|| (&array, &filter_mask, session.create_execution_ctx()))
.bench_refs(|(array, filter_mask, ctx)| {
array
.clone()
.mask(filter_mask.clone().into_array())
.unwrap()
.execute::<RecursiveCanonical>(&mut ctx)
.execute::<RecursiveCanonical>(ctx)
.unwrap()
});
}
Loading
Loading