We are trying to get rid of boost::regex and it's awful performance. According to this benchmark, Oniguruma is the best overall.
We have multiple regexps (and always changing) which we apply on strings ranging from medium (100 chars) to huge (1k chars)... so it's a very heterogeneous environment.
Have any of you used it with success? Do you recommend going for the more "standard" ones like PCRE or RE2?
I've done a benchmark with the following librairies:
The benchmark consisted of executing a series of tests which made heavy use of regexps on very heterogeneous regexps (grouping, not grouping, long ones (484 characters), short ones, pipes, ?, *, ., etc.). Applied on texts that go from a few characters to around 8k characters.
Each time a regexp match was computed, I stored the regexp and incremented a milliseconds counter accumulating the time spent computing the regexp (called multiple times).
Here is the total time spent on all regexps for each libraries:
*We (almost) always want to capture the content of groups in regexp, and re2 performs horribly when it captures a group(see here). You don't see that much in the above result because when the group cannot be captured, it performs well. For example on this regexp (executed a lot of times):
^((?:https?://)?(?:[a-z0-9\-]{1,63}\.)+(?:[a-z0-9\-]{1,63}))(?:[^\?]*).*$
here are the results for each libs:
See the drop for re2 from 5663 ms to 37 ms.
So my conclusion is that for our use, Oniguruma is clearly superior.
But if you don't need to capture groups, re2 is a better choice since I found that it's API is easier to use.