Benchmark Results
Raw benchmark tables for the battle_bench reference suite:
Ferroni (Rust) vs Oniguruma at -O3, with
regex included where the syntax is
compatible.
Measured with Criterion on Apple M1 Ultra.
Re-run with
./scripts/prepare-oniguruma-sources.sh && cargo bench --features ffi --bench battle_benchto get current numbers on your hardware.
The README intentionally rounds values for readability. This file keeps the raw numbers.
Measurement context
Exact external input revisions for the publishable battle suite are pinned in
benches/battle_inputs.toml.
| Field | Value |
|---|---|
| Ferroni commit | e8f120aa64a122ebdfdda5d44ebcb7550235ea3f |
| Measurement date | 2026-03-06 16:04 CET |
| Host | Mac13,2 (Apple M1 Ultra, 64 GB) |
| macOS | 26.3 |
rustc | rustc 1.95.0-nightly (842bd5be2 2026-01-29) |
| Command | ./scripts/prepare-oniguruma-sources.sh && cargo bench --features ffi --bench battle_bench |
| Input pins | benches/battle_inputs.toml |
Reference suite (battle_bench)
Where the pattern is compatible with the regex crate syntax, we include it
for comparison. Bold = fastest engine. A dash means the feature is not
supported by the regex crate.
Text search and log scanning
| Scenario | Ferroni | Oniguruma | regex |
|---|---|---|---|
| Literal in 50 KB | 73.625 ns | 129.910 ns | 10.238 ns |
| No match, 50 KB | 1.500 us | 9.217 us | 1.436 us |
| No match, 10 KB | 369.519 ns | 1.918 us | 296.251 ns |
| Field extract, 50 KB | 103.788 ns | 163.257 ns | 54.746 ns |
| Timestamp, 50 KB | 81.102 ns | 159.923 ns | 96.311 ns |
| RegSet multi-pattern (5) | 97.976 ns | 385.195 ns | — |
Pattern matching
| Category | Ferroni | Oniguruma | regex |
|---|---|---|---|
| Literal exact | 94.558 ns | 135.280 ns | 11.077 ns |
| Quantifier greedy | 152.132 ns | 239.941 ns | 63.088 ns |
| Lookaround combined | 78.500 ns | 279.991 ns | — |
Unicode \p{Greek}+ | 96.288 ns | 236.438 ns | 57.992 ns |
Backref (\w+) \1 | 79.834 ns | 168.520 ns | — |
| Case-insensitive phrase | 93.563 ns | 175.405 ns | 60.179 ns |
| Alternation, 2 branches | 66.909 ns | 139.808 ns | 49.756 ns |
| Alternation, 10 branches | 52.273 ns | 232.464 ns | 21.315 ns |
| Named capture date | 241.920 ns | 282.236 ns | 45.475 ns |
Compilation
| Pattern | Ferroni | Oniguruma | regex |
|---|---|---|---|
| Literal | 521.266 ns | 533.510 ns | 2.966 us |
| Named capture | 6.243 us | 6.431 us | 219.380 us |
| Lookbehind | 1.174 us | 643.704 ns | — |
Scanner with full Shiki TextMate grammars
Full, unmodified grammars from shikijs/textmate-grammars-themes.
| Scenario | Ferroni | Oniguruma | Factor |
|---|---|---|---|
| TypeScript (279 patterns) | |||
| Compile | 11.986 ms | 17.431 ms | 1.45x |
| First match, short line | 423.541 ns | 24.931 us | 58.9x |
| Tokenize full line | 6.860 us | 217.101 us | 31.6x |
| CSS (117 patterns) | |||
| Compile | 14.387 ms | 19.967 ms | 1.39x |
| Tokenize (multi-line) | 1.305 ms | 14.733 ms | 11.3x |
| Rust (81 patterns) | |||
| Compile | 313.695 us | 196.406 us | 0.63x |
| First match | 163.055 ns | 5.480 us | 33.6x |
| Tokenize full line | 8.263 us | 78.471 us | 9.5x |
Reproducing
# Reference suite for publishable Ferroni-vs-C numbers
./scripts/prepare-oniguruma-sources.sh
cargo bench --features ffi --bench battle_bench
# Internal Rust-only regression suite
cargo bench --bench codspeed_bench
# HTML report
open target/criterion/report/index.html