Skip to content

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_bench to 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.

FieldValue
Ferroni commite8f120aa64a122ebdfdda5d44ebcb7550235ea3f
Measurement date2026-03-06 16:04 CET
HostMac13,2 (Apple M1 Ultra, 64 GB)
macOS26.3
rustcrustc 1.95.0-nightly (842bd5be2 2026-01-29)
Command./scripts/prepare-oniguruma-sources.sh && cargo bench --features ffi --bench battle_bench
Input pinsbenches/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

ScenarioFerroniOnigurumaregex
Literal in 50 KB73.625 ns129.910 ns10.238 ns
No match, 50 KB1.500 us9.217 us1.436 us
No match, 10 KB369.519 ns1.918 us296.251 ns
Field extract, 50 KB103.788 ns163.257 ns54.746 ns
Timestamp, 50 KB81.102 ns159.923 ns96.311 ns
RegSet multi-pattern (5)97.976 ns385.195 ns

Pattern matching

CategoryFerroniOnigurumaregex
Literal exact94.558 ns135.280 ns11.077 ns
Quantifier greedy152.132 ns239.941 ns63.088 ns
Lookaround combined78.500 ns279.991 ns
Unicode \p{Greek}+96.288 ns236.438 ns57.992 ns
Backref (\w+) \179.834 ns168.520 ns
Case-insensitive phrase93.563 ns175.405 ns60.179 ns
Alternation, 2 branches66.909 ns139.808 ns49.756 ns
Alternation, 10 branches52.273 ns232.464 ns21.315 ns
Named capture date241.920 ns282.236 ns45.475 ns

Compilation

PatternFerroniOnigurumaregex
Literal521.266 ns533.510 ns2.966 us
Named capture6.243 us6.431 us219.380 us
Lookbehind1.174 us643.704 ns

Scanner with full Shiki TextMate grammars

Full, unmodified grammars from shikijs/textmate-grammars-themes.

ScenarioFerroniOnigurumaFactor
TypeScript (279 patterns)
Compile11.986 ms17.431 ms1.45x
First match, short line423.541 ns24.931 us58.9x
Tokenize full line6.860 us217.101 us31.6x
CSS (117 patterns)
Compile14.387 ms19.967 ms1.39x
Tokenize (multi-line)1.305 ms14.733 ms11.3x
Rust (81 patterns)
Compile313.695 us196.406 us0.63x
First match163.055 ns5.480 us33.6x
Tokenize full line8.263 us78.471 us9.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