3 ms·
NOTE re2 is not the same as re2c here re2 is Google's safe regexp engine that works as a state-machine and isn't suspectible to exponential runtime attacks tha
by whizzter 3y ago
NOTE re2 is not the same as re2c here
re2 is Google's safe regexp engine that works as a state-machine and isn't suspectible to exponential runtime attacks that can affect backtracking engines, it trades some performance for guaranteed non-fatal worst case scenarios.
the C# compiled regexps is backtracking (fast by default) JIT compiled searchers so it's extremely fast (on the level of source-compiled matchers).
- burntsushi 3y agoNote that .NET has a non-backtracking engine now too. It's included in the rebar measurements.
- whizzter 3y agoYeah noticed, just pointing out that it's not 2x faster (still faster though and that's impressive!). I implemented an basic DFA based engine like re2 once as an exercise and there was a performance cost (and building it cost a bit) so I wonder if they JIT non backtracking variant also?
- burntsushi 3y agoNot sure. But rust/regex (of which I am the author) is above pcre2/jit in rebar's measurements. Hyperscan is too. All of rust/regex, Hyperscan and RE2 use finite automata, no JIT and no backtracking. There is more to the perf of a regex engine than whether it uses a JIT or not. :) Many of the curated rebar benchmarks (in the README) do not just list numbers. They also try to contextualize those numbers. (I am only one person though with limited expertise, so they tend to bias toward what I know. But still, it's miles better than what you'll see in most benchmarks IMO.) And of course, make sure to read the BIAS document.