Benchmark and conformance harnesses for the ron
parser, kept out of ron's own tree because they pull in serde_json, pest, and
two ron versions at once — dependencies that don't belong in the library's graph.
Three independent crates, one workspace:
| crate | what it measures |
|---|---|
ronprof |
RON-vs-serde_json throughput differential, per token type |
conformance |
ron's parser vs a reference PEG grammar (ron.pest) + a perf-fuzzer |
scaling_oracle |
reusable doubling-ratio oracle: is a hot path O(N) or O(N²)? |
Every crate parses with the same ron, set once in the root Cargo.toml:
[workspace.dependencies]
ron = { git = "https://github.com/enomado/ron", branch = "perf/scalar-parser-hotpath" }To A/B two parsers, point that one line at each and re-run:
- baseline —
git = "https://github.com/ron-rs/ron", branch = "master" - improved —
git = "https://github.com/enomado/ron", branch = "perf/scalar-parser-hotpath"(upstream master + the scalar hot-path optimizations, ron-rs/ron#616)
Or [patch] it at a local checkout.
Parses payloads that are pure floats / ints / strings / mixed, so the worst RON/JSON ratio points straight at the culprit token type.
cargo run --release -p ronprof -- diffThe deterministic A/B signal is instruction count, not wall-clock MB/s (a busy machine makes MB/s wander between runs). Pin a core and count instructions per mode:
taskset -c 2 perf stat -e instructions ./target/release/ronprof intloop 400
taskset -c 2 perf stat -e instructions ./target/release/ronprof ronloop 200 # mixedMeasured this way, perf/scalar-parser-hotpath vs upstream master:
| workload | master | perf branch | Δ instr |
|---|---|---|---|
| integers | 253.7e9 | 156.0e9 | −38% |
| floats | 434.5e9 | 257.3e9 | −41% |
| strings | 30.5e9 | 24.2e9 | −21% |
| mixed | 280.9e9 | 180.0e9 | −36% |
ron.pest is a PEG transcribed from ron's grammar. The differential parses a battery
of inputs (and, optionally, every *.ron under given dirs) with both the pest reference
and ron's parser and reports where they disagree — each disagreement is a parser bug or
a grammar/doc bug.
cargo run --release -p ron-conformance --bin ron_conformance # hand battery
cargo run --release -p ron-conformance --bin ron_conformance -- path/ # + sweep *.ronron_perf_fuzz generates valid RON from the grammar's repeatable units and adversarial
scan-in-loop shapes, then runs the scaling oracle to hunt for quadratic parse behaviour
on forms a human wouldn't hand-write. It links ron (fixed) and stock ron 0.12.2
(quadratic bugs live) side by side, so the oracle is non-circular.
cargo run --release -p ron-conformance --bin ron_perf_fuzzA #[track_caller] assert_linear that doubles the input across sizes and asserts the
per-doubling time ratio stays near 2, not 4. Strong where a naive 2-point ratio flakes:
min-of-N per size, sustained verdict across every doubling, setup kept out of the timer,
and a loud guard when the smallest measurement is too small to trust. The same method
found two O(N²) bugs in ron (#607,
#609).
cargo test --release -p scaling_oracleSome inline comments in these crates are still in Russian (the crate-level docs and this README are English). Translation is a pending cleanup, not a blocker to reading the code.