Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

performance of java.util.regex

807580Jul 2 2010 — edited Jul 8 2010
Hi,

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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2010
Added on Jul 2 2010
24 comments
735 views