Saturday, January 15, 2011

jakarta regexp vs java.util.regex

Have never really been thinking about which library to use for regular expression, it always was java.util.regex by default. But I found that some people prefer to use Jakarta Regexp, and usually there is not clear reason for that choice. So, I decided to spent some time trying to find out what is better and probably write a couple of tests. After some time spent in the Internet looking for the examples of tests, it appeared that there was a good guy already who have done all that work. Here is the link to the page with results of his investigation:

http://tusker.org/regex/regex_benchmark.html

The conclusion is that Jakarta Regexp doesn't look good at all. Also you may notice that there are some other libraries who are doing regexps and some have very impressive performance and seems like worth trying.

UPDATE 09/2012: Thank's for comments from Cd MaN, there is newer update of that benchmark: http://hype-free.blogspot.ro/2008/12/big-java-regex-shoutout.html

2 comments:

Cd MaN said...

I repeated the experiment in 2008 (the original experiment was done in 2002 I think) and found java.util.regex pretty performant: http://hype-free.blogspot.ro/2008/12/big-java-regex-shoutout.html - I would maybe use dk.brics.automaton.* if the expressions were simple and speed was paramount.

Stas said...

Thanks, mate! Updated with your link.