You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
|
use gntag::get_world;
|
|
|
|
fn world(c: &mut Criterion) {
|
|
let mut group = c.benchmark_group("world");
|
|
let width: isize = 1000;
|
|
for spacing in (50..=100).step_by(25) {
|
|
group.throughput(Throughput::Elements((width / spacing).pow(2) as u64));
|
|
group.bench_with_input(
|
|
BenchmarkId::new("validating", spacing),
|
|
&spacing,
|
|
|b, &spacing| {
|
|
let mut world = get_world(width, width, spacing as usize, true);
|
|
b.iter(|| world.do_step());
|
|
},
|
|
);
|
|
group.bench_with_input(
|
|
BenchmarkId::new("non-validating", spacing),
|
|
&spacing,
|
|
|b, &spacing| {
|
|
let mut world = get_world(width, width, spacing as usize, false);
|
|
b.iter(|| world.do_step());
|
|
},
|
|
);
|
|
}
|
|
group.finish();
|
|
}
|
|
|
|
criterion_group!(benches, world);
|
|
criterion_main!(benches);
|
|
|
|
// 5000/1000 -> 9,993
|
|
// 5/01 -> 23,252
|
|
// 50/10 -> 14,000
|
|
// 100/20 -> 14,000
|
|
// 100/10 -> 96,000
|
|
// 100/05 -> 917,767
|
|
// 200/10 -> 916,172
|
|
// 1000/10 -> 443,482,526
|