|
1 | 1 | use anyhow::Result; |
2 | 2 | use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; |
3 | | -use once_cell::unsync::Lazy; |
| 3 | +use std::cell::LazyCell; |
4 | 4 | use std::path::Path; |
5 | 5 | use std::process::Command; |
6 | 6 | use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst}; |
@@ -35,7 +35,7 @@ fn bench_sequential(c: &mut Criterion, path: &Path) { |
35 | 35 | benchmark_name(&strategy), |
36 | 36 | path.file_name().unwrap().to_str().unwrap(), |
37 | 37 | ); |
38 | | - let state = Lazy::new(|| { |
| 38 | + let state = LazyCell::new(|| { |
39 | 39 | let mut config = Config::default(); |
40 | 40 | config.allocation_strategy(strategy.clone()); |
41 | 41 |
|
@@ -70,7 +70,7 @@ fn bench_parallel(c: &mut Criterion, path: &Path) { |
70 | 70 | let mut group = c.benchmark_group("parallel"); |
71 | 71 |
|
72 | 72 | for strategy in strategies() { |
73 | | - let state = Lazy::new(|| { |
| 73 | + let state = LazyCell::new(|| { |
74 | 74 | let mut config = Config::default(); |
75 | 75 | config.allocation_strategy(strategy.clone()); |
76 | 76 |
|
@@ -153,7 +153,7 @@ fn bench_deserialize_module(c: &mut Criterion, path: &Path) { |
153 | 153 |
|
154 | 154 | let name = path.file_name().unwrap().to_str().unwrap(); |
155 | 155 | let tmpfile = tempfile::NamedTempFile::new().unwrap(); |
156 | | - let state = Lazy::new(|| { |
| 156 | + let state = LazyCell::new(|| { |
157 | 157 | let engine = Engine::default(); |
158 | 158 | let module = Module::from_file(&engine, path).expect("failed to load WASI example module"); |
159 | 159 | let bytes = module.serialize().unwrap(); |
|
0 commit comments