wind_test/
lib.rs

1pub mod benches {
2	use std::sync::Arc;
3
4	use criterion::{Criterion, black_box};
5
6	pub fn bench_arc_comparison(c: &mut Criterion) {
7		let mut group = c.benchmark_group("Arc Creation");
8
9		group.bench_function("Arc::from(Vec<u8>)", |b| {
10			b.iter(|| {
11				let s = String::from("hello rusthello rusthello rusthello rusthello rusthello rust");
12				let vec = s.into_bytes();
13				black_box(Arc::<[u8]>::from(vec));
14			})
15		});
16
17		group.bench_function("Arc::from(Box<[u8]>)", |b| {
18			b.iter(|| {
19				let s = String::from("hello rusthello rusthello rusthello rusthello rusthello rust");
20				let vec = s.into_bytes();
21				black_box(Arc::<[u8]>::from(vec.into_boxed_slice()));
22			})
23		});
24
25		group.finish();
26	}
27}