diff options
author | Aria Shrimpton <me@aria.rip> | 2024-02-27 09:41:23 +0000 |
---|---|---|
committer | Aria Shrimpton <me@aria.rip> | 2024-02-27 09:41:23 +0000 |
commit | fad685c53308f9fd7a449f23d5123ee56080e51b (patch) | |
tree | 8e483e5caa380208320ecb05c14e32fc11f7c9a8 /src/tests/example_stack/benches | |
parent | abc050060403d0d41c1a7c4a5e29b8b26f6e5d1b (diff) |
cleanup example_ benchmarks
Diffstat (limited to 'src/tests/example_stack/benches')
-rw-r--r-- | src/tests/example_stack/benches/do_stuff.rs | 10 | ||||
-rw-r--r-- | src/tests/example_stack/benches/main.rs | 16 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/tests/example_stack/benches/do_stuff.rs b/src/tests/example_stack/benches/do_stuff.rs deleted file mode 100644 index 91f21fb..0000000 --- a/src/tests/example_stack/benches/do_stuff.rs +++ /dev/null @@ -1,10 +0,0 @@ -use criterion::{criterion_group, criterion_main, Criterion}; - -fn run_benches(c: &mut Criterion) { - c.bench_function("example_stack-do_something", |b| { - b.iter(|| example_stack::do_something()) - }); -} - -criterion_group!(benches, run_benches); -criterion_main!(benches); diff --git a/src/tests/example_stack/benches/main.rs b/src/tests/example_stack/benches/main.rs new file mode 100644 index 0000000..575d045 --- /dev/null +++ b/src/tests/example_stack/benches/main.rs @@ -0,0 +1,16 @@ +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; + +fn run_benches(c: &mut Criterion) { + for size in [500, 10_000, 50_000].iter() { + c.bench_with_input( + BenchmarkId::new("example_stack-push_pop", size), + size, + |b, &n| { + b.iter(|| example_stack::push_pop(n)); + }, + ); + } +} + +criterion_group!(benches, run_benches); +criterion_main!(benches); |