Varaq: one lookup with every page in memory, one thread Measured in a Claude Code cloud session (a Firecracker VM), 2026-11-11. Configuration of the engine's criterion tree/get row: 20,000 keys of 8 bytes, 1,300-byte values, a pool of 65,536 frames, in memory; successive lookups step the key by 7,919. Release build. Three runs of the program below; each prints nine batches of two million lookups and their median. The three medians are 1,037.0, 954.7 and 1,041.5 ns; their median, 1,037 ns, is the post's 1.04 µs. A read-only review agent was running in the same session during the runs (load average 0.65). == machine and output date: 2026-11-11T12:07:37Z kernel: 6.18.44-fc-v378 model name : Intel(R) Xeon(R) Processor @ 2.10GHz vCPUs: 4 MemTotal: 16472084 kB rustc: rustc 1.97.0 (2d8144b78 2026-07-07) varaq: arriqaaq/varaq e34250c load: 0.65 0.25 0.13 1/113 11802 == run 1 batch 1: 1037.0 ns per lookup batch 2: 1158.5 ns per lookup batch 3: 960.4 ns per lookup batch 4: 885.0 ns per lookup batch 5: 959.8 ns per lookup batch 6: 926.3 ns per lookup batch 7: 1049.3 ns per lookup batch 8: 1107.9 ns per lookup batch 9: 1140.4 ns per lookup median of 9 batches of 2000000 lookups: 1037.0 ns per lookup == run 2 batch 1: 954.3 ns per lookup batch 2: 964.2 ns per lookup batch 3: 974.8 ns per lookup batch 4: 933.7 ns per lookup batch 5: 956.7 ns per lookup batch 6: 896.8 ns per lookup batch 7: 932.9 ns per lookup batch 8: 954.7 ns per lookup batch 9: 1015.8 ns per lookup median of 9 batches of 2000000 lookups: 954.7 ns per lookup == run 3 batch 1: 1068.7 ns per lookup batch 2: 1026.2 ns per lookup batch 3: 1041.5 ns per lookup batch 4: 1126.5 ns per lookup batch 5: 968.6 ns per lookup batch 6: 1124.0 ns per lookup batch 7: 1002.2 ns per lookup batch 8: 1024.5 ns per lookup batch 9: 1112.6 ns per lookup median of 9 batches of 2000000 lookups: 1041.5 ns per lookup == Cargo.toml [package] name = "lookupbench" version = "0.1.0" edition = "2024" [dependencies] varaq = { path = "/home/user/varaq/crates/varaq" } [profile.release] opt-level = 3 codegen-units = 1 lto = "thin" [workspace] == src/main.rs //! One lookup through Varaq's tree with every page in memory, one thread: the configuration of the //! engine's criterion `tree/get` row (20,000 keys of 8 bytes, 1,300-byte values, a pool of 65,536 //! frames, in memory; each lookup steps the key by 7,919 so successive lookups land on different //! leaves). Prints the machine, then nanoseconds per lookup for each of nine batches of two million //! lookups, and their median. use std::hint::black_box; use std::time::Instant; use varaq::tree::Tree; const KEYS: u64 = 20_000; const VALUE: usize = 1_300; const POOL: usize = 65_536; const BATCH: u64 = 2_000_000; const BATCHES: usize = 9; fn key(i: u64) -> [u8; 8] { i.to_be_bytes() } fn value(i: u64) -> Vec { (0..VALUE).map(|j| (i as usize * 31 + j) as u8).collect() } fn main() -> Result<(), varaq::Error> { let tree = Tree::with_capacity(POOL)?; for i in 0..KEYS { tree.insert(&key(i), &value(i))?; } let mut i = 0_u64; let mut found = 0_u64; // warm up: every leaf touched, caches and branch predictors settled for _ in 0..BATCH { i = i.wrapping_add(7_919); if black_box(tree.get(&key(i % KEYS))?).is_some() { found += 1; } } let mut ns = Vec::with_capacity(BATCHES); for b in 0..BATCHES { let t = Instant::now(); for _ in 0..BATCH { i = i.wrapping_add(7_919); if black_box(tree.get(&key(i % KEYS))?).is_some() { found += 1; } } let per = t.elapsed().as_nanos() as f64 / BATCH as f64; println!("batch {}: {:.1} ns per lookup", b + 1, per); ns.push(per); } assert_eq!(found, BATCH * (BATCHES as u64 + 1), "every lookup must find its key"); ns.sort_by(|a, b| a.partial_cmp(b).unwrap()); println!("median of {} batches of {} lookups: {:.1} ns per lookup", BATCHES, BATCH, ns[BATCHES / 2]); Ok(()) }