3 ms·
I tested it also for inclusion into cperl to replace the horrible old spencer regex code with longjmp for logical control and double parsing, and came to my con
by rurban 9y ago
I tested it also for inclusion into cperl to replace the horrible old spencer regex code with longjmp for logical control and double parsing, and came to my conclusions. Rust's will get better eventually, but PCRE2 also gets better every week. That time PCRE2 was a bit faster, and supported more features. And it has a JIT. Only Hyperscan, PCRE2 and sregex have a JIT.
I haven't checked Rust's feature list, sorry. I ruled it out for serious usage very early, and it's still evolving.
Captures are very important for us. Same as UTF8.
There was once the idea to switch to a limited engine like RE2 after the first scan of the regex when it doesn't do backtracking. But then I would switch to Hyperscan instead, which has the best compiler, besides having a very good SIMD optimized runtime.
- burntsushi 9y agoSorry, but there are still inaccuracies in your comments. Hyperscan doesn't have a JIT. PCRE2 and sregex are not the only ones with a JIT. For example, PyPy's regex engine is JITed and so is v8's. The existence of Hyperscan (and Rust's regex engine) should show that a JIT is not necessary for high performance. (Disclaimer: I am the author of Rust's regex library.)
- rurban 9y agoI would qualify the Hyperscan engine as "JIT". Not a traditional, but practically. It's dynamic architecture-optimized superfast bytecode, but much more native than a normal platform-independent bytecode. Look e.g. at the nfa limex interpreter/runtime. It uses intel opcodes dynamically for various SIMD features, simd128,256,384,512. Yes, pypy and v8 also have a jit, but not usable as library. ruby extracted their regex library, so I could use it also. pypy and v8 did not.