&gt; Notably, Rust also edges out a multi-threaded C implementation for that one. I&#x27;m sure they&#x27;ve done some very hairy optimizations to get to the top on that board, but it&#x27;s cool to see that it&#x27;s possible.<p>The most important optimization I did was to avoid regex machinery as much as possible. In particular, Rust&#x27;s regex library has very good support for prefix literal optimizations. In particular, regexes like `abc[x-z]foo|bar` will compile down to an aho-corasick[1] automaton over the strings `abcxfoo`, `abcyfoo`, `abczfoo` and `bar` with the failure transitions completely evaluated. (The end result is an automaton represented by a matrix. This is memory intensive, so only prefix literals of a certain size can be accommodated. But you don&#x27;t need a lot to realize huge gains!)<p>I wrote more about it here: <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;39unje&#x2F;ahocorasick_fast_multisubstring_matching&#x2F;cs6lnxp" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;rust&#x2F;comments&#x2F;39unje&#x2F;ahocorasick_fa...</a><p>Hint: most of the benchmark game regexes are relatively simple and compile down to either simple `memchr` calls (most regex engines will do that, nothing special) or a aho-corasick DFA that completely avoids the traditional regex evaluation machinery.<p>In general, regex implementations differ dramatically in the optimizations they perform. It&#x27;s hard to draw conclusions about them without some explicit knowledge of how it is implemented.<p>[1] - <a href="https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;aho-corasick" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;aho-corasick</a>