6. Benchmark method
Rules: same machine, pinned versions, warm-up, median of 5 cold processes per cell, raw JSON Lines committed, charts generated from them.
Contenders (pinned in bench/Cargo.toml)
perennial (this commit), imbl 7.0.2, im 15.1.0, im-rc 15.1.0, rpds 1.2.1, and std
(BTreeMap, HashMap, Vec) as the ceiling. Each collection is used with its defaults
(default hasher, default pointer kind) and, separately, the Rc flavour against im-rc and rpds'
non-sync types.
Workloads (n = 1,000, 100,000 and 1,000,000 unless stated)
| Id | Workload | Types |
|---|---|---|
| insert | build by n inserts of shuffled u64 keys | maps, sets |
| lookup | n successful lookups in shuffled order | maps, sets |
| remove | remove every key, shuffled | maps, sets |
| iterate | sum all values by iterator | all |
| clone-mutate | clone, then 10 inserts, repeated n/10 times keeping every version alive | maps, Vector |
| push-back | n push_back |
Vector |
| index | read every index in order and in random order | Vector |
| concat | concat 1,000 vectors of n/1,000 | Vector |
| split | split at random points until pieces are < 64, then rejoin | Vector |
| resolver | replay of a cargo-resolver-shaped trace: OrdMap/HashMap context cloned at each backtrack point | maps, sets |
Keys are u64 from a fixed-seed generator; a String key variant runs for insert and lookup.
Harness
bench/ is a separate crate with one binary. Each invocation runs one (contender, workload,
n) cell after a warm-up and prints one JSON line: contender and version, workload, n, ns per
operation, rustc version, CPU, cores, RAM, OS, and the 1-minute load average at start. A
driver script runs every cell in 5 fresh processes in random order and keeps all lines;
charts and the README table use the median. Runs only when the 1-minute load is under 6 and no
other benchmark is running on the machine.
Outputs
bench/results/<date>-<machine>.jsonl, bench/charts.json, scripts/bench-charts.mjs →
assets/bench-*.svg (light and dark) and the README table. CI re-renders and fails on a diff.