Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix benchmarks #1799

Merged
merged 3 commits into from
Apr 8, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
--all-features \
-p re_arrow_store \
-p re_data_store \
-p re_log_types \
-p re_log_encoding \
-p re_query \
-p re_tuid \
-- --output-format=bencher | tee output.txt
Expand Down
5 changes: 2 additions & 3 deletions crates/re_arrow_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ deadlock_detection = ["parking_lot/deadlock_detection"]
## Integration with `polars`, to efficiently use the datastore with dataframes.
polars = ["dep:polars-core", "dep:polars-ops"]

## When set, disables costly benchmark suites that measure the performance of third-party
## libraries.
## When set, only run the core set of benchmark suites.
## Commonly set implicitly by --all-features, e.g. on CI.
dont_bench_third_party = []
core_benchmarks_only = []


[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/benches/arrow2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ use re_log_types::{

criterion_group!(benches, erased_clone, estimated_size_bytes);

#[cfg(not(feature = "dont_bench_third_party"))]
#[cfg(not(feature = "core_benchmarks_only"))]
criterion::criterion_main!(benches);

// Don't run these benchmarks on CI: they measure the performance of third-party libraries.
#[cfg(feature = "dont_bench_third_party")]
#[cfg(feature = "core_benchmarks_only")]
fn main() {}

// ---
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/benches/arrow2_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use re_log_types::{

criterion_group!(benches, serialize, deserialize);

#[cfg(not(feature = "dont_bench_third_party"))]
#[cfg(not(feature = "core_benchmarks_only"))]
criterion::criterion_main!(benches);

// Don't run these benchmarks on CI: they measure the performance of third-party libraries.
#[cfg(feature = "dont_bench_third_party")]
#[cfg(feature = "core_benchmarks_only")]
fn main() {}

// ---
Expand Down
44 changes: 31 additions & 13 deletions crates/re_arrow_store/benches/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,32 @@ const NUM_ROWS: i64 = 1;
#[cfg(debug_assertions)]
const NUM_INSTANCES: i64 = 1;

fn packed() -> &'static [bool] {
#[cfg(feature = "core_benchmarks_only")]
{
&[false]
}
#[cfg(not(feature = "core_benchmarks_only"))]
{
&[false, true]
}
}

fn num_rows_per_bucket() -> &'static [u64] {
#[cfg(feature = "core_benchmarks_only")]
{
&[]
}
#[cfg(not(feature = "core_benchmarks_only"))]
{
&[0, 2, 32, 2048]
}
}

// --- Benchmarks ---

fn insert(c: &mut Criterion) {
for packed in [false, true] {
for &packed in packed() {
let mut group = c.benchmark_group(format!(
"datastore/num_rows={NUM_ROWS}/num_instances={NUM_INSTANCES}/packed={packed}/insert"
));
Expand All @@ -45,9 +67,8 @@ fn insert(c: &mut Criterion) {
b.iter(|| insert_table(Default::default(), InstanceKey::name(), &table));
});

// Emulate more or less buckets
let num_rows_per_bucket = [0, 2, 32, 2048];
for num_rows_per_bucket in num_rows_per_bucket {
// Emulate more or less bucket
for &num_rows_per_bucket in num_rows_per_bucket() {
group.bench_function(format!("bucketsz={num_rows_per_bucket}"), |b| {
b.iter(|| {
insert_table(
Expand All @@ -68,7 +89,7 @@ fn insert(c: &mut Criterion) {
}

fn latest_at(c: &mut Criterion) {
for packed in [false, true] {
for &packed in packed() {
let mut group = c.benchmark_group(format!(
"datastore/num_rows={NUM_ROWS}/num_instances={NUM_INSTANCES}/packed={packed}/latest_at"
));
Expand All @@ -92,8 +113,7 @@ fn latest_at(c: &mut Criterion) {
});

// Emulate more or less buckets
let num_rows_per_bucket = [0, 2, 32, 2048];
for num_rows_per_bucket in num_rows_per_bucket {
for &num_rows_per_bucket in num_rows_per_bucket() {
let store = insert_table(
DataStoreConfig {
index_bucket_nb_rows: num_rows_per_bucket,
Expand Down Expand Up @@ -122,7 +142,7 @@ fn latest_at(c: &mut Criterion) {
}

fn latest_at_missing(c: &mut Criterion) {
for packed in [false, true] {
for &packed in packed() {
let mut group = c.benchmark_group(format!(
"datastore/num_rows={NUM_ROWS}/num_instances={NUM_INSTANCES}/packed={packed}/latest_at_missing"
));
Expand Down Expand Up @@ -157,8 +177,7 @@ fn latest_at_missing(c: &mut Criterion) {
});

// Emulate more or less buckets
let num_rows_per_bucket = [0, 2, 32, 2048];
for num_rows_per_bucket in num_rows_per_bucket {
for &num_rows_per_bucket in num_rows_per_bucket() {
let store = insert_table(
DataStoreConfig {
index_bucket_nb_rows: num_rows_per_bucket,
Expand Down Expand Up @@ -198,7 +217,7 @@ fn latest_at_missing(c: &mut Criterion) {
}

fn range(c: &mut Criterion) {
for packed in [false, true] {
for &packed in packed() {
let mut group = c.benchmark_group(format!(
"datastore/num_rows={NUM_ROWS}/num_instances={NUM_INSTANCES}/packed={packed}/range"
));
Expand All @@ -214,8 +233,7 @@ fn range(c: &mut Criterion) {
});

// Emulate more or less buckets
let num_rows_per_bucket = [0, 2, 32, 2048];
for num_rows_per_bucket in num_rows_per_bucket {
for &num_rows_per_bucket in num_rows_per_bucket() {
let store = insert_table(
DataStoreConfig {
index_bucket_nb_rows: num_rows_per_bucket,
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/benches/vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ use tinyvec::TinyVec;

criterion_group!(benches, sort, split, swap, swap_opt);

#[cfg(not(feature = "dont_bench_third_party"))]
#[cfg(not(feature = "core_benchmarks_only"))]
criterion::criterion_main!(benches);

// Don't run these benchmarks on CI: they measure the performance of third-party libraries.
#[cfg(feature = "dont_bench_third_party")]
#[cfg(feature = "core_benchmarks_only")]
fn main() {}

// ---
Expand Down