use core::hint::black_box;
use arrayvec::ArrayString;
use arrayvec_util::array_format;
use criterion::{Criterion, criterion_group, criterion_main};
pub fn criterion_benchmark(c: &mut Criterion) {
let name = "John Doe";
c.bench_function("array_format macro", |b| {
b.iter(|| {
black_box::<ArrayString<22>>(array_format!("Hello World, {name}!"));
})
});
c.bench_function("format macro", |b| {
b.iter(|| {
black_box(format!("Hello World, {name}!"));
})
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);