Skip to content.

Manageability

Sections
Personal tools
You are here: Home » blog » archive » Regex Engines Benchmarked
Views
  • State: published

Regex Engines Benchmarked

Document Actions
20030210194736

I found a benchmark for Java based regex engines. I ran the benchmark with the latest released versions using JDK 1.4.1, here are my results:

  • java.util.regex.Pattern took 813ms
  • jregex.Pattern took 781ms
  • org.apache.oro.text.regex.Perl5Matcher took 1141ms
  • dk.brics.automaton.RegExp took 359ms
  • com.karneim.util.collection.regex.Pattern took 375ms
  • com.karneim.util.collection.regex.PatternPro took 625ms

In summary, the standard JDK class performs better than older open source regex engines like ORO. JRegex is a better performer, considering that it has more functionality, it may be viable alternative. However, if you need more speed, a fast DFA based engine even though they are less expressive is almost twice as fast.

Out of further curiosity, I tested the C# regex class using a more streamlined benchmark:

  • C# regex took 2.53153991699219 secs
  • com.karneim.util.collection.regex.Pattern took 0.125 secs

As expected, C#'s immature library rears its ugly head again! C# regex is 20 times slower than JRexx. The next question then is, how does this compare to Perl or Grep?


Last modified 2003-12-22 10:05 AM

Any future plans to benchmark perl and grep? . . .

Posted by Anonymous User Anonymous User at 2003-10-28 02:09 PM

Just out of curiosity, do you have any future plans to benchmark perl and grep?

I second that.

Posted by Anonymous User Anonymous User at 2003-12-16 01:03 PM

I would love to see the Perl and grep numbers.

I can't duplicate your .NET results..

Posted by Anonymous User Anonymous User at 2004-08-28 05:33 PM

http://www.codinghorror.com/blog/archives/000065.html

Did you ask the .Net Regex library to compile the regex first?

Posted by Anonymous User Anonymous User at 2005-06-28 02:49 PM

Did you ask the .Net Regex library to compile the regex first? Or did you leave it in interpreted mode?

Cheers!

 

Powered by Plone

This site conforms to the following standards: