On 5/4/13 6:54 AM, Devin Jeanpierre wrote:
     A point brought up in #rust: if we use RE2 or similar, we may not
     be able to have a re!() syntax extension that compiles regexps at
     the same time as the surrounding rust code.

I like the re!() extension idea, just for performance reasons. If you look at regexp-dna in the shootout, V8 is at the top, significantly ahead of C: this is because it JITs regexes. Regex performance is important for Web servers, because of routes.

     RE2 has a good summary of regex syntax, although it doesn't
     specify for PCRE-family syntax whether it comes from perl, libpcre,
     python, or something else.

Note that, as far as I'm aware, RE2 has pretty bad performance in general (see Go's performance in regexp-dna). I'm actually personally somewhat skeptical of the practical advantages of the Thompson NFA algorithm compared to recursive backtracking: it makes pathological regexes much faster, but at the cost of significant overhead for non-pathological regexes (which are 99% of regexes used in reality).

To me the hybrid approach is interesting: try recursive backtracking first, and if it takes too long fall back to the Thompson NFA, to avoid the DoS problem.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to