This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / knot2 / crates / knot-bench / benches / projection.rs
1.2 kB 37 lines
1use divan::Bencher; 2use divan::counter::ItemsCount; 3use knot_bench::{RepoCount, RosterCount, build_collaborator_roster, build_registry}; 4 5#[global_allocator] 6static ALLOC: divan::AllocProfiler = divan::AllocProfiler::system(); 7 8const ROSTER_GRADES: &[u32] = &[64, 512, 4096]; 9const REGISTRY_GRADES: &[u64] = &[64, 4096]; 10 11fn main() { 12 divan::main(); 13} 14 15#[divan::bench(args = ROSTER_GRADES)] 16fn collaborator_refresh(bencher: Bencher, collaborators: u32) { 17 let built = build_collaborator_roster(RosterCount::new(collaborators)); 18 let index = built.index(); 19 index.rebuild().expect("rebuild"); 20 index 21 .ensure_collaborators(built.repo()) 22 .expect("first fold"); 23 bencher 24 .counter(ItemsCount::new(collaborators as usize)) 25 .bench_local(|| index.refresh_collaborators(built.repo()).expect("refresh")); 26} 27 28#[divan::bench(args = REGISTRY_GRADES)] 29fn resolve(bencher: Bencher, repos: u64) { 30 let registry = build_registry(RepoCount::new(repos)); 31 let index = registry.index(); 32 index.rebuild().expect("rebuild"); 33 let (owner, rkey) = registry.alias(repos / 2); 34 bencher 35 .counter(ItemsCount::new(1usize)) 36 .bench_local(|| index.resolve_repo(&owner, &rkey)); 37}