Skip to content

Commit

Permalink
ci: fix benchmarks (#1799)
Browse files Browse the repository at this point in the history
* workflow: just run --all

* datastore: skip bucket permutations etc on CI

* i give up, just replace re_log_types by re_log_encoding
  • Loading branch information
teh-cmc authored Apr 8, 2023
1 parent 880cf8e commit e3f572f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 23 deletions.
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

1 comment on commit e3f572f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: e3f572f Previous: aedf1c0 Ratio
datastore/num_rows=1000/num_instances=1000/packed=false/insert/default 11575476 ns/iter (± 688622) 11124028 ns/iter (± 545736) 1.04
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at/default 1809 ns/iter (± 15) 1839 ns/iter (± 17) 0.98
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/primary/default 278 ns/iter (± 0) 281 ns/iter (± 0) 0.99
datastore/num_rows=1000/num_instances=1000/packed=false/latest_at_missing/secondaries/default 440 ns/iter (± 2) 435 ns/iter (± 0) 1.01
datastore/num_rows=1000/num_instances=1000/packed=false/range/default 12352247 ns/iter (± 772207) 13013954 ns/iter (± 914184) 0.95
mono_points_arrow/generate_message_bundles 48276625 ns/iter (± 1397029) 46219650 ns/iter (± 501669) 1.04
mono_points_arrow/generate_messages 172700989 ns/iter (± 1490257) 150704994 ns/iter (± 1097138) 1.15
mono_points_arrow/encode_log_msg 200215428 ns/iter (± 1409723) 185868787 ns/iter (± 1379264) 1.08
mono_points_arrow/encode_total 423220801 ns/iter (± 2426710) 380900460 ns/iter (± 1699524) 1.11
mono_points_arrow/decode_log_msg 253529959 ns/iter (± 1198838) 229719289 ns/iter (± 950455) 1.10
mono_points_arrow/decode_message_bundles 84116550 ns/iter (± 1373716) 72131554 ns/iter (± 814385) 1.17
mono_points_arrow/decode_total 344891240 ns/iter (± 2570130) 307506573 ns/iter (± 1565973) 1.12
mono_points_arrow_batched/generate_message_bundles 41535573 ns/iter (± 1799262) 39855428 ns/iter (± 1133909) 1.04
mono_points_arrow_batched/generate_messages 8656223 ns/iter (± 993434) 8178592 ns/iter (± 704181) 1.06
mono_points_arrow_batched/encode_log_msg 1658024 ns/iter (± 5637) 1488672 ns/iter (± 5221) 1.11
mono_points_arrow_batched/encode_total 53520656 ns/iter (± 2841832) 50010094 ns/iter (± 1500823) 1.07
mono_points_arrow_batched/decode_log_msg 945416 ns/iter (± 3479) 854696 ns/iter (± 2147) 1.11
mono_points_arrow_batched/decode_message_bundles 12660668 ns/iter (± 673928) 12974920 ns/iter (± 956692) 0.98
mono_points_arrow_batched/decode_total 14547484 ns/iter (± 923681) 13404586 ns/iter (± 622594) 1.09
batch_points_arrow/generate_message_bundles 336960 ns/iter (± 1141) 290531 ns/iter (± 765) 1.16
batch_points_arrow/generate_messages 6376 ns/iter (± 28) 6336 ns/iter (± 12) 1.01
batch_points_arrow/encode_log_msg 453146 ns/iter (± 1968) 392563 ns/iter (± 1460) 1.15
batch_points_arrow/encode_total 798510 ns/iter (± 3665) 705362 ns/iter (± 2469) 1.13
batch_points_arrow/decode_log_msg 392739 ns/iter (± 1564) 340823 ns/iter (± 2014) 1.15
batch_points_arrow/decode_message_bundles 2314 ns/iter (± 6) 2347 ns/iter (± 8) 0.99
batch_points_arrow/decode_total 393182 ns/iter (± 1465) 348071 ns/iter (± 3330) 1.13
arrow_mono_points/insert 7518086366 ns/iter (± 21814282) 6344097421 ns/iter (± 17255353) 1.19
arrow_mono_points/query 1856154 ns/iter (± 17882) 1773561 ns/iter (± 9441) 1.05
arrow_batch_points/insert 3334078 ns/iter (± 13647) 3146877 ns/iter (± 14047) 1.06
arrow_batch_points/query 17120 ns/iter (± 49) 17203 ns/iter (± 47) 1.00
arrow_batch_vecs/insert 47904 ns/iter (± 197) 44533 ns/iter (± 133) 1.08
arrow_batch_vecs/query 522963 ns/iter (± 1398) 506150 ns/iter (± 389) 1.03
tuid/Tuid::random 34 ns/iter (± 0) 34 ns/iter (± 0) 1

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.