blob: 454bb1dac2d9f0df330b426dee87521ff2e29b69 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Copyleft (ɔ) 2021-2021 Fuwn
// SPDX-License-Identifier: GPL-3.0-only
#[macro_use]
extern crate criterion;
use criterion::Criterion;
use rand::Rng;
fn bench_generate(c: &mut Criterion) {
c.bench_function("generate", |b| {
b.iter(|| {
rand::thread_rng()
.sample_iter(rand::distributions::Alphanumeric)
.take(16)
.map(char::from)
.collect::<String>()
})
});
}
criterion_group!(benches, bench_generate);
criterion_main!(benches);
|