Skip to content.

Manageability

Sections
Personal tools
You are here: Home » blog » archive » Perhaps im missing the point...

Comment

Above in this comment thread: The Ultimate Java Versus C# Benchmark » Incorrect use of regex

Perhaps im missing the point...

Posted by Anonymous User at 2006-04-23 03:36 PM

However if you are doing a straight up Text Sequence Match ( which is what the example code is doing ) then you would use the .IndexOf method off the string object.

Of Course Im probably missing the point.. but you used the term Real World up there...

In Main, make the following change...

Comment : Regex regexpr = new Regex(matchthis.ToString(), RegexOptions.Compiled);

Comment : Boolean b = regexpr.IsMatch(_doc);

Replace : if (B) with : if ( _doc.IndexOf( matchthis.ToString()) > -1 )

When reRun, with no other changes, causes an end number of approximately ".NET regex took 1687 miliseconds"

Would be interested in seeing the Java equivalent change + perf. With the understanding that a implementation .IndexOf Java equivalent will probably be significantly different then .net

.Net version was 1.1

 
 

Powered by Plone

This site conforms to the following standards: