diff --git a/benchmarks/criterion/Cargo.toml b/benchmarks/criterion/Cargo.toml index 48e136f59..62d5e0efb 100644 --- a/benchmarks/criterion/Cargo.toml +++ b/benchmarks/criterion/Cargo.toml @@ -14,4 +14,6 @@ harness = false [dependencies] criterion = "0.3.0" sled = { path = "../.." } + +[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies] jemallocator = "0.3.2" diff --git a/benchmarks/criterion/benches/sled.rs b/benchmarks/criterion/benches/sled.rs index b5e3f5826..3e6331b38 100644 --- a/benchmarks/criterion/benches/sled.rs +++ b/benchmarks/criterion/benches/sled.rs @@ -1,15 +1,11 @@ use criterion::{criterion_group, criterion_main, Criterion}; -use jemallocator::Jemalloc; - use sled::Config; -#[cfg_attr( - // only enable jemalloc on linux and macos by default - any(target_os = "linux", target_os = "macos"), - global_allocator -)] -static ALLOC: Jemalloc = Jemalloc; +// only enable jemalloc on linux and macos by default +#[cfg(any(target_os = "linux", target_os = "macos"))] +#[global_allocator] +static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; fn counter() -> usize { use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};