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 / tests / registry_gate.rs
1.4 kB 44 lines
1#![cfg(feature = "instrument")] 2 3use knot_bench::{RepoCount, build_registry_checkpointed}; 4use knot_cob::instrument::measure; 5 6#[test] 7fn a_checkpointed_registry_write_reads_a_bounded_object_set() { 8 let small = build_registry_checkpointed(RepoCount::new(512)); 9 let large = build_registry_checkpointed(RepoCount::new(1024)); 10 11 let (_, full_small) = measure(|| small.full_fold()); 12 let (_, full_large) = measure(|| large.full_fold()); 13 let (_, write_small) = measure(|| small.probe()); 14 let (_, write_large) = measure(|| large.probe()); 15 16 assert_eq!( 17 full_small.get(), 18 2 * 512, 19 "full fold reads every change's commit and payload, so twice the change count" 20 ); 21 assert_eq!( 22 full_large.get(), 23 2 * 1024, 24 "full fold the checkpoint replaces is linear in repo count" 25 ); 26 assert_eq!( 27 write_small.get(), 28 write_large.get(), 29 "checkpointed write reads only the bounded suffix, the same object count at 512 \ 30 repos as at 1024" 31 ); 32 assert!( 33 write_large.get() <= 2 * 256, 34 "per-write read set is bounded by twice the snapshot stride, not the repo count, \ 35 was {}", 36 write_large.get() 37 ); 38 assert!( 39 write_large.get() < full_large.get() / 3, 40 "checkpoint cuts per-write object reads far below the full fold, {} vs {}", 41 write_large.get(), 42 full_large.get() 43 ); 44}