"You assume the benchmark is worth something.
First of all, Ruby and Python are using C implementations of the regexp search, so Go is being beat by C, not by Ruby.
Second, Go is using a different algorithm for regexp matching than the C implementations in those other languages. The algorithm Go uses guarantees to complete in time that is linear in the length of the input. The algorithm that Ruby/Python/etc are using can take time exponential in the length of the input, although on trivial cases it typically runs quite fast."[1]
[1] https://groups.google.com/d/msg/golang-nuts/6d1maef4jQ8/yg4N...
I think the more serious problem is that what most people consider to be a 'regular expression' does not express a regular language, and hence cannot be expressed as a finite state automaton.
Yes, but for larger recognizers, one would probably use something like Ragel anyway. A DSL that provides intersection, union, difference, concatenation, composition, etc. makes it far easier to construct elaborate automata from smaller expression than the 'compile a big regex string' approach.
http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?t...
Here's a C++ program that uses RE2
http://benchmarksgame.alioth.debian.org/u64/program.php?test...
EDIT: Since apparently someone doesn't believe me: http://blog.chromium.org/2009/02/irregexp-google-chromes-new... ("After optimization we generate native machine code which uses backtracking to try different alternatives.") See also the yarr JIT, which jsc and SpiderMonkey use for regular expressions: http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/y....
http://benchmarksgame.alioth.debian.org/u64/program.php?test...
And why did someone do "a reimplementation of RE2 in Go" ?