Skip to content

Commit

Permalink
update insert correct benchmark timings
Browse files Browse the repository at this point in the history
  • Loading branch information
billythedummy committed Oct 8, 2023
1 parent 5306ad9 commit a6f4138
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions benches/insert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ fn bench_ten_k_insert<C: Insert<K, V> + CreateNew, K: From<u16>, V: From<u16>>(
});
}

// 126 ns
// 3.6 us
pub fn u8_insert_const_lru(c: &mut Criterion) {
bench_insert::<ConstLru<u8, u64, 255, u8>, _, _>(c, "u8 insert ConstLru");
}

// 337 ns
// 5.8 us
pub fn u8_insert_const_lru_i_usize(c: &mut Criterion) {
bench_insert::<ConstLru<u8, u64, 255, usize>, _, _>(c, "u8 insert ConstLru I=usize");
}

// 2 ns
// 11.6 us
pub fn u8_insert_hashmap(c: &mut Criterion) {
bench_insert::<HashMap<u8, u64>, _, _>(c, "u8 insert HashMap");
}
Expand All @@ -67,46 +67,46 @@ pub fn u8_insert_hashmap(c: &mut Criterion) {

// TODO: figure out why BigStruct insert is 2x faster than u8

// 57 ns
// 100.7 us
pub fn bigstruct_insert_const_lru(c: &mut Criterion) {
bench_insert::<Box<ConstLru<BigStruct, BigStruct, 255, u8>>, _, _>(
c,
"bigstruct insert ConstLru",
);
}

// 62 ns
// 97 us
pub fn bigstruct_insert_const_lru_i_usize(c: &mut Criterion) {
bench_insert::<Box<ConstLru<BigStruct, BigStruct, 255, usize>>, _, _>(
c,
"bigstruct insert ConstLru I=usize",
);
}

// 2 ns
// 239 us
pub fn bigstruct_insert_hashmap(c: &mut Criterion) {
bench_insert::<HashMap<BigStruct, BigStruct>, _, _>(c, "bigstruct insert HashMap");
}

// 1.2 us
// 1.2 ms
pub fn ten_k_insert_const_lru(c: &mut Criterion) {
bench_ten_k_insert::<Box<ConstLru<u16, u64, 10_000, u16>>, _, _>(c, "10k insert ConstLru");
}

// 2.1 ns
// 375 us
pub fn ten_k_insert_hashmap(c: &mut Criterion) {
bench_ten_k_insert::<HashMap<u16, u64>, _, _>(c, "10k insert HashMap");
}

// 1.7 us
// 6.5 ms
pub fn ten_k_bigstruct_insert_const_lru(c: &mut Criterion) {
bench_ten_k_insert::<Box<ConstLru<BigStruct, BigStruct, 10_000, u16>>, _, _>(
c,
"10k bigstruct insert ConstLru",
);
}

// 2.2 ns
// 18.8 ms
pub fn ten_k_bigstruct_insert_hashmap(c: &mut Criterion) {
bench_ten_k_insert::<HashMap<BigStruct, BigStruct>, _, _>(c, "10k bigstruct insert HashMap");
}

0 comments on commit a6f4138

Please sign in to comment.