#[macro_use] extern crate criterion; use criterion::Criterion; use nanoid; fn bench_std(c: &mut Criterion) { let name = format!("standard ({})", X); let f = nanoid::standard::; c.bench_function(&name, |b| { b.iter(|| { f(); }); }); } fn bench_std_unsecure(c: &mut Criterion) { let name = format!("standard (unsecure) ({})", X); let f = nanoid::standard_unsecure::; c.bench_function(&name, |b| { b.iter(|| { f(); }); }); } fn bench_canonic(c: &mut Criterion) { let f = nanoid::standard::<21>; c.bench_function("canonic", |b| { b.iter(|| { f(); }); }); } fn bench_canonic_unsecure(c: &mut Criterion) { let f = nanoid::standard_unsecure::<21>; c.bench_function("canonic (unsecure)", |b| { b.iter(|| { f(); }); }); } criterion_group!(benches, bench_std::<8>); criterion_main!(benches);