Re:Go bindings to Rust's regex engine
by AYBABTME on Monday May 02, 2016 @03:43PM
(#11614857)
curious, why is the compile-time regex slower? is it just a less efficient implementation?
[ Parent
| on HN ]
Re:Go bindings to Rust's regex engine
by burntsushi on Monday May 02, 2016 @04:10PM
(#11615119)
Regex::new has these tools at its disposal: Pike VM (NFA), backtracking (NFA), DFA (online), DFA (offline), Boyer-Moore
The plugin has these tools at its disposal: Pike VM.
But yeah, killercup is correct. The DFA (online) is one of the bigger reasons. But the offline DFA and Boyer-Moore are probably just as important.
You might glean more information from my hacking guide: https://github.com/rust-lang-nursery/regex/blob/master/HACKI...
Yes, several of the optimizations of the dynamic regexes aren't available in the compile-time version. (It doesn't even have a DFA, IIRC.)
There is [a lint][1] which checks that your regular expressions are valid (at compile time), though.
[1]: https://github.com/Manishearth/rust-clippy/wiki#invalid_rege...