Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jofas committed Aug 4, 2022
2 parents 3680d03 + 9d12dd6 commit b30e167
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions benches/benches.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use map_macro::map;

use criterion::{black_box, criterion_group, criterion_main, Criterion};
use criterion::{
black_box, criterion_group, criterion_main, Criterion,
};

use std::time::Duration;

fn reapeatedly_allocate_map() {
for _ in 0..500_000 {
map!{
map! {
0 => "a",
1 => "b",
2 => "c",
Expand Down Expand Up @@ -39,10 +41,12 @@ fn reapeatedly_allocate_map() {

#[allow(clippy::unit_arg)]
fn bench_map_allocation(c: &mut Criterion) {
c.bench_function(
"map allocation",
|b| b.iter(|| black_box(reapeatedly_allocate_map())),
);
c.bench_function("map allocation", |b| {
b.iter(|| {
reapeatedly_allocate_map();
black_box(())
})
});
}

criterion_group!(
Expand Down

0 comments on commit b30e167

Please sign in to comment.