Skip to content

Commit

Permalink
added timeless_logs GC benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 30, 2023
1 parent 6f52d49 commit dc13021
Showing 1 changed file with 70 additions and 1 deletion.
71 changes: 70 additions & 1 deletion crates/re_arrow_store/benches/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use re_log_types::{
use re_types::components::InstanceKey;
use re_types_core::{AsComponents, ComponentBatch, ComponentName, Loggable as _};

criterion_group!(benches, plotting_dashboard);
criterion_group!(benches, plotting_dashboard, timeless_logs);
criterion_main!(benches);

// ---
Expand Down Expand Up @@ -121,6 +121,75 @@ fn plotting_dashboard(c: &mut Criterion) {
}
}

fn timeless_logs(c: &mut Criterion) {
const DROP_AT_LEAST: f64 = 0.3;

let mut group = c.benchmark_group(format!(
"datastore/num_entities={NUM_ENTITY_PATHS}/num_rows_per_entity={NUM_ROWS_PER_ENTITY_PATH}/timeless_logs/drop_at_least={DROP_AT_LEAST}"
));
group.throughput(criterion::Throughput::Elements(
((NUM_ENTITY_PATHS * NUM_ROWS_PER_ENTITY_PATH) as f64 * DROP_AT_LEAST) as _,
));
group.sample_size(10);

let gc_settings = GarbageCollectionOptions {
target: GarbageCollectionTarget::DropAtLeastFraction(DROP_AT_LEAST),
gc_timeless: true,
protect_latest: 1,
purge_empty_tables: false,
dont_protect: Default::default(),
};

let mut timegen = |_| TimePoint::timeless();

let mut datagen = |i: usize| {
Box::new(re_types::archetypes::TextLog::new(i.to_string())) as Box<dyn AsComponents>
};

// Default config
group.bench_function("default", |b| {
let store = build_store(
Default::default(),
InstanceKey::name(),
false,
&mut timegen,
&mut datagen,
);
b.iter_batched(
|| store.clone(),
|mut store| {
let (_, stats_diff) = store.gc(&gc_settings);
stats_diff
},
BatchSize::LargeInput,
);
});

// 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| {
let store = build_store(
DataStoreConfig {
indexed_bucket_num_rows: num_rows_per_bucket,
..Default::default()
},
InstanceKey::name(),
false,
&mut timegen,
&mut datagen,
);
b.iter_batched(
|| store.clone(),
|mut store| {
let (_, stats_diff) = store.gc(&gc_settings);
stats_diff
},
BatchSize::LargeInput,
);
});
}
}

// --- Helpers ---

fn build_store<FT, FD>(
Expand Down

0 comments on commit dc13021

Please sign in to comment.