py -3 scripts/bench_stage_results.py \
--baseline "F:/code-backup/patternia/build/bench/result.json" \
--current "F:/code/patternia/build/bench/result.json"This writes:
bench/results/baseline/result.jsonbench/results/current/result.json
(If you pass a directory, the script auto-appends result.json.)
py -3 scripts/bench_compare.pyDefault outputs:
build/bench/compare/bench_compare.pngbuild/bench/compare/bench_compare.md
Use this when one JSON already contains multiple implementations (Patternia / if-else / switch / std::visit) and you want per-scenario comparison.
py -3 scripts/bench_single_report.py `
--input build/variant_all.json `
--include "Variant|ProtocolRouter|CommandParser" `
--outdir build/bench/single `
--prefix single_implOutputs:
build/bench/single/single_impl.pngbuild/bench/single/single_impl.mdbuild/bench/single/single_impl.csv
The PNG is a Patternia-focused gap map:
- each scenario is normalized to its fastest implementation (
1.00x) - the Patternia result is the diamond marker
- grey dots are alternative implementations
- rows are sorted by the largest Patternia gap first
The CSV includes filter-ready columns:
is_patterniafastest_implimpl_vs_fastest_pctimpl_vs_patternia_pctpatternia_rankpatternia_vs_fastest_pctpatternia_status
You can also rebuild a report from an existing CSV:
py -3 scripts/bench_single_report.py `
--input docs/assets/bench/latest.csv `
--outdir docs/assets/bench `
--prefix latestpy -3 scripts/bench_compare.py \
--include "PacketMixedHeavyBind" \
--label-baseline "backup" \
--label-current "current" \
--prefix "packet_heavy"Variant benchmarks now include an in-code stable profile (ns unit, min time, repetitions, aggregate report). You can run the variant suite directly:
.\build\bench\ptn_bench.exe `
--benchmark_filter="Variant(Mixed|AltHot)" `
--benchmark_out=build/bench/result.json `
--benchmark_out_format=jsonpy -3 scripts/bench_compare.py \
--include "Variant(Mixed|AltHot)" \
--fail-if-regress-pct 3.0 \
--fail-if-mean-regress-pct 1.5--fail-if-regress-pct: fail when any selected benchmark regresses beyond threshold.--fail-if-mean-regress-pct: fail when mean regression across selected benchmarks exceeds threshold.
py -3 -m pip install matplotlib