This repository has no description
891 B
30 lines
1use divan::Bencher;
2use divan::counter::ItemsCount;
3use knot_bench::{RefCount, build_many_refs};
4
5#[global_allocator]
6static ALLOC: divan::AllocProfiler = divan::AllocProfiler::system();
7
8const GRADES: &[u32] = &[16, 256, 4096];
9
10fn main() {
11 divan::main();
12}
13
14#[divan::bench(args = GRADES)]
15fn advert_uncached(bencher: Bencher, refs: u32) {
16 let built = build_many_refs(RefCount::new(refs));
17 let count = built.repo().references().unwrap().len();
18 bencher
19 .counter(ItemsCount::new(count))
20 .bench_local(|| built.repo().references().unwrap());
21}
22
23#[divan::bench(args = GRADES)]
24fn advert_cached(bencher: Bencher, refs: u32) {
25 let built = build_many_refs(RefCount::new(refs));
26 let count = built.repo().advertised_refs().unwrap().len();
27 bencher
28 .counter(ItemsCount::new(count))
29 .bench_local(|| built.repo().advertised_refs().unwrap());
30}