ic_stable_memory/benches/
mod.rs1use std::time::{SystemTime, UNIX_EPOCH};
2
3mod btree_map;
4mod btree_set;
5mod certified_map;
6mod hash_map;
7mod hash_set;
8mod log;
9mod vec;
10
11#[ignore]
12pub fn now_milli() -> u128 {
13 SystemTime::now()
14 .duration_since(UNIX_EPOCH)
15 .unwrap()
16 .as_millis()
17}
18
19#[macro_export]
20macro_rules! measure {
21 ($name:literal, $iterations:expr, $it:block) => {
22 let before = $crate::benches::now_milli();
23 $it;
24 let after = $crate::benches::now_milli();
25
26 println!(
27 "{} {} iterations: {} ms",
28 stringify!($name),
29 $iterations,
30 after - before
31 );
32 };
33}