Four distributions, two compilers.
Debian 12, Ubuntu 24.04, Fedora 44 and Alpine 3.24 passed builds and calculator/ticket examples with GCC and Clang, in disposable VMs using their own kernels.
A C++98 parser generator.
Three contributions, with evidence.
THE PROJECT / RUG
RUG — Rug Understands Grammar — compiles ABNF into packed LALR(1) tables. Its immutable runtime image can be shared by incremental parsing sessions, with semantic callbacks and explicit workspace control.
fe40fab82c61a6fdd95fa49162a289e703644f1cTHE INITIAL AUDIT
Portability and robustness were established before proposing changes. These checks describe the baseline audit, not a new four-distro campaign for the optimized code.
Debian 12, Ubuntu 24.04, Fedora 44 and Alpine 3.24 passed builds and calculator/ticket examples with GCC and Clang, in disposable VMs using their own kernels.
Ten host build configurations and 60 deterministic ASan/UBSan workload checks passed. Bounded grammar and runtime fuzz campaigns completed 44,476 and 48,605 executions without a confirmed sanitizer finding. This is not proof of safety.
THE UPSTREAM CONTRIBUTIONS
Each PR contains its own change and tests. The performance PRs also include measured pairs and standalone reproduction scripts.
| Contribution | What changed | PR | Status |
|---|---|---|---|
Structured grammar diagnostics | Reject empty/comment-only grammars through RugBuildError instead of leaking logic_error past callers catching the documented type. | #1 | Open |
Packed table lookups | Resolve immutable ACTION/GOTO/rule section addresses once per lookup, avoiding repeated out-of-line accessor calls. | #2 | Open |
Default-action frequency counts | Replace quadratic recounting of 257 actions with frequency counts and an ordered selection pass, preserving ties. | #3 | Open |
Status snapshot: 2026-10-23 UTC. Follow each PR for current discussion; submitted does not mean accepted.
THE MEASURED RESULTS
Two separate before/after experiments on the same machine and compiler. Their gains must not be multiplied or presented as a combined result.
PARSING / 18 SHAPES
20.6–37.0 %Across six workloads and three chunk sizes. Ten paired trials per case, following warmup.
Method and raw pairsGRAMMAR CONSTRUCTION / 6 INPUTS
15.9–31.1×Full repeated Rug build/destruction. Complete runtime images matched byte for byte for the six grammars.
Method and raw pairsRyzen 9 3900X · GCC 16.2.1 · C++98 · -O2 -g -fno-omit-frame-pointer · no LTO. These are workload-specific observations, not universal speedups or results merged upstream.
A CLOSER LOOK
Parsing below uses 4096-byte chunks; the report includes all three chunk sizes. Construction values are per full build. Ratios use paired medians.
| Workload | Parsing time reduction | Baseline build | Optimized build | Build speedup |
|---|---|---|---|---|
tiny | 23.6 % | 0.944 ms | 0.033 ms | 28.53× |
medium | 25.9 % | 15.726 ms | 0.506 ms | 31.05× |
large | 25.9 % | 61.787 ms | 2.242 ms | 27.57× |
binary | 21.1 % | 61.323 ms | 2.535 ms | 24.13× |
calculator | 37.0 % | 21.855 ms | 1.372 ms | 15.87× |
ticket | 33.0 % | 31.989 ms | 1.390 ms | 22.92× |
The parsing and construction columns describe different isolated code changes, not a single combined binary.
THE TOOLS / WHAT THEY ACTUALLY DID
The approach follows workload characterization, a partial USE screen, CPU profiling and controlled experiments, inspired by Brendan Gregg’s public methods.
A local omn 0.1.0 build identified lookup/accessor costs and table-construction hotspots. Five paired PMU runs observed 26.5% fewer retired instructions for parsing and 96.8% for construction on fixed workloads. Analysis of the source led to the patches; the tool did not optimize code automatically.
distroproof supplied the baseline VM matrix. ATFQ supplied memory context, xpac read package inventory; neither was a RUG profiler. VMAnyware was not used. Omniscient’s full BPF-backed USE/latency modes refused missing permissions; available user-space CPU sources were used instead.
VALIDATION & LIMITS
Both candidates passed fresh GCC and Clang ASan/UBSan builds, independent oracles, examples and differential incremental traces. The optimizations were not re-tested on the four-distro matrix, with LTO or on other hardware.
REPORTS & REPRODUCTION
Download the report, inspect the data, or follow the independent reproduction instructions in each performance PR.
Independent contribution by moha-bekh. PR status is the dated snapshot above; no RUG maintainer endorsement is implied.