performance of java.util.regex
807580Jul 2 2010 — edited Jul 8 2010Hi,
I wrote [a very simple benchmark|http://mypatterns.free.fr/java/stable/mypatterns/doc/regex.html] for measuring the cost of regex matching, as provided by java.util.regex, and I'm obtaining an overhead between 10 to 13 times(!!) for a very simple regex:
"File ([^ ]*) not (found|readable).*!!!"
when compared with equivalent hand-coded matching.
The questions I have are:
- is it a well-known fact that java.util.regex matching can add an overhead of an order of magnitude on simple cases?
- if not, is there a problem in my benchmark?