34 lines
831 B
Rust
34 lines
831 B
Rust
use autobarts::geom::Point;
|
|
use criterion::Criterion;
|
|
|
|
//
|
|
// Benchmark Parameters
|
|
//
|
|
pub const BENCH_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);
|
|
pub const BENCH_NUM_INSERT: i32 = 50_000;
|
|
pub const BENCH_NODE_CAPACITY: usize = 5;
|
|
|
|
//
|
|
// Data Generation Functions (Raw Data)
|
|
//
|
|
pub fn generate_2d_data() -> Vec<Point> {
|
|
let data: Vec<Point> = (0..BENCH_NUM_INSERT)
|
|
.map(|i| {
|
|
let point = bevy::prelude::Vec2::new(i as f32, i as f32);
|
|
|
|
Point {
|
|
point,
|
|
entity: bevy::prelude::Entity::PLACEHOLDER,
|
|
}
|
|
})
|
|
.collect();
|
|
|
|
data
|
|
}
|
|
|
|
// Configure Criterion with a timeout for benchmarks
|
|
pub fn configure_criterion() -> Criterion {
|
|
Criterion::default()
|
|
.measurement_time(BENCH_TIMEOUT)
|
|
.sample_size(10)
|
|
}
|