-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathbench.rs
More file actions
58 lines (49 loc) · 1.21 KB
/
bench.rs
File metadata and controls
58 lines (49 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use commonware_cryptography::{Hasher, Sha256};
use commonware_runtime::{
telemetry::metrics::{Metric, Registered, Registration},
Metrics, Name, Supervisor,
};
use criterion::criterion_main;
mod hashmap_insert;
mod hashmap_insert_fixed;
mod hashmap_iteration;
mod insert;
mod insert_and_prune;
mod lookup;
mod lookup_miss;
pub(crate) type Digest = <Sha256 as Hasher>::Digest;
#[derive(Clone)]
pub(crate) struct DummyMetrics;
impl Supervisor for DummyMetrics {
fn child(&self, _: &'static str) -> Self {
Self
}
fn with_attribute(self, _: &'static str, _: impl std::fmt::Display) -> Self {
Self
}
fn name(&self) -> Name {
Name::default()
}
}
impl Metrics for DummyMetrics {
fn register<N: Into<String>, H: Into<String>, M: Metric>(
&self,
_: N,
_: H,
metric: M,
) -> Registered<M> {
Registered::with_registration(metric, Registration::from(()))
}
fn encode(&self) -> String {
"".into()
}
}
criterion_main!(
hashmap_iteration::benches,
hashmap_insert_fixed::benches,
hashmap_insert::benches,
insert::benches,
insert_and_prune::benches,
lookup::benches,
lookup_miss::benches,
);