mirror of https://github.com/xacrimon/dashmap
Removed benchmarks.
This commit is contained in:
parent
25bd24777f
commit
a2d02f2482
24
Cargo.toml
24
Cargo.toml
|
@ -17,30 +17,6 @@ default = []
|
|||
raw-api = []
|
||||
no_std = ["hashbrown"]
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3.2"
|
||||
rayon = "1.3.0"
|
||||
chashmap = "2.2.2"
|
||||
contrie = "0.1.4"
|
||||
cht = "0.4.1"
|
||||
fxhash = "0.2.1"
|
||||
|
||||
[[bench]]
|
||||
name = "rwlock_std"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "dashmap"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "chashmap"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "contrie"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
num_cpus = "1.13.0"
|
||||
ahash = "0.3.5"
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
use chashmap::CHashMap;
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
use rayon::prelude::*;
|
||||
use std::cmp;
|
||||
|
||||
const ITER: u64 = 8 * 1024;
|
||||
|
||||
fn task_insert_chashmap_u64_u64() -> CHashMap<u64, u64> {
|
||||
let map = CHashMap::with_capacity(ITER as usize);
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
map.insert(i, i + 7);
|
||||
});
|
||||
map
|
||||
}
|
||||
|
||||
fn insert_chashmap_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("insert_chashmap_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = cmp::min(num_cpus::get(), 24);
|
||||
|
||||
for threads in &[1, max] {
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(task_insert_chashmap_u64_u64));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
fn task_get_chashmap_u64_u64(map: &CHashMap<u64, u64>) {
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
assert_eq!(*map.get(&i).unwrap(), i + 7);
|
||||
});
|
||||
}
|
||||
|
||||
fn get_chashmap_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("get_chashmap_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
let map = task_insert_chashmap_u64_u64();
|
||||
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(|| task_get_chashmap_u64_u64(&map)));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, insert_chashmap_u64_u64, get_chashmap_u64_u64);
|
||||
criterion_main!(benches);
|
|
@ -1,68 +0,0 @@
|
|||
use contrie::ConMap;
|
||||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
use rayon::prelude::*;
|
||||
|
||||
const ITER: u64 = 8 * 1024;
|
||||
|
||||
fn task_insert_contrie_u64_u64() -> ConMap<u64, u64> {
|
||||
let map = ConMap::new();
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
map.insert(i, i + 7);
|
||||
});
|
||||
map
|
||||
}
|
||||
|
||||
fn insert_contrie_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("insert_contrie_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(task_insert_contrie_u64_u64));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
fn task_get_contrie_u64_u64(map: &ConMap<u64, u64>) {
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
assert_eq!(*map.get(&i).unwrap().value(), i + 7);
|
||||
});
|
||||
}
|
||||
|
||||
fn get_contrie_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("get_contrie_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
let map = task_insert_contrie_u64_u64();
|
||||
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(|| task_get_contrie_u64_u64(&map)));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, insert_contrie_u64_u64, get_contrie_u64_u64);
|
||||
criterion_main!(benches);
|
|
@ -1,71 +0,0 @@
|
|||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
use dashmap::DashMap as DMF;
|
||||
use fxhash::FxBuildHasher;
|
||||
use rayon::prelude::*;
|
||||
|
||||
type DashMap<K, V> = DMF<K, V, FxBuildHasher>;
|
||||
|
||||
const ITER: u64 = 32 * 1024;
|
||||
|
||||
fn task_insert_dashmap_u64_u64() -> DashMap<u64, u64> {
|
||||
let map = DashMap::with_capacity_and_hasher(ITER as usize, FxBuildHasher::default());
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
map.insert(i, i + 7);
|
||||
});
|
||||
map
|
||||
}
|
||||
|
||||
fn insert_dashmap_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("insert_dashmap_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(task_insert_dashmap_u64_u64));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
fn task_get_dashmap_u64_u64(map: &DashMap<u64, u64>) {
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
assert_eq!(*map.get(&i).unwrap(), i + 7);
|
||||
});
|
||||
}
|
||||
|
||||
fn get_dashmap_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("get_dashmap_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
let map = task_insert_dashmap_u64_u64();
|
||||
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(|| task_get_dashmap_u64_u64(&map)));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, insert_dashmap_u64_u64, get_dashmap_u64_u64);
|
||||
criterion_main!(benches);
|
|
@ -1,69 +0,0 @@
|
|||
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
|
||||
use rayon::prelude::*;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::RwLock;
|
||||
|
||||
const ITER: u64 = 2 * 1024;
|
||||
|
||||
fn task_insert_rwlock_std_u64_u64() -> RwLock<HashMap<u64, u64>> {
|
||||
let map = RwLock::new(HashMap::with_capacity(ITER as usize));
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
map.write().unwrap().insert(i, i + 7);
|
||||
});
|
||||
map
|
||||
}
|
||||
|
||||
fn insert_rwlock_std_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("insert_rwlock_std_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(task_insert_rwlock_std_u64_u64));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
fn task_get_rwlock_std_u64_u64(map: &RwLock<HashMap<u64, u64>>) {
|
||||
(0..ITER).into_par_iter().for_each(|i| {
|
||||
assert_eq!(*map.read().unwrap().get(&i).unwrap(), i + 7);
|
||||
});
|
||||
}
|
||||
|
||||
fn get_rwlock_std_u64_u64(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("get_rwlock_std_u64_u64");
|
||||
group.throughput(Throughput::Elements(ITER as u64));
|
||||
let max = num_cpus::get();
|
||||
|
||||
for threads in &[1, max] {
|
||||
let map = task_insert_rwlock_std_u64_u64();
|
||||
|
||||
group.bench_with_input(
|
||||
BenchmarkId::from_parameter(threads),
|
||||
&threads,
|
||||
|b, &threads| {
|
||||
let pool = rayon::ThreadPoolBuilder::new()
|
||||
.num_threads(*threads)
|
||||
.build()
|
||||
.unwrap();
|
||||
pool.install(|| b.iter(|| task_get_rwlock_std_u64_u64(&map)));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
group.finish();
|
||||
}
|
||||
|
||||
criterion_group!(benches, insert_rwlock_std_u64_u64, get_rwlock_std_u64_u64);
|
||||
criterion_main!(benches);
|
Loading…
Reference in New Issue