[Mono-devel-list] String::Equals Performance

Andreas Nahr ClassDevelopment at A-SoftTech.com
Sun Jul 4 05:25:45 EDT 2004


Sorry for the wrong thread ;)

First: Unfortunatelly I posted the wrong version that was causing
regressions, so please forget it. I attached the working one...

So some benchmark results:
short comparison (2 chars): 3475ms -> 2644ms
long comparison (88 chars): 5497ms -> 941ms
huge comparison (961 chars): 56391ms -> 7661ms

All test done on windows against mono 1.0 release with full optimization.
I'll attach the precompiled benchmarks for the cases above (I change the
sources to generate the microbenchmarks, so this is the only way)

By the way: I won't post benchmarks against MS, but I think they have to do
quite some work until they can match our new impl...
Try yourself ;)

Andreas


----- Original Message ----- 
From: "Ben Maurer" <bmaurer at ximian.com>
To: "Andreas Nahr" <ClassDevelopment at A-SoftTech.com>
Sent: Sunday, July 04, 2004 2:12 AM
Subject: Re: [Mono-devel-list] String::Equals Performance


> (I assume you did not mean to continue the OOo thread)
>
> On Sat, 2004-07-03 at 19:35, Andreas Nahr wrote:
> > this is a patch to speedup the Equals - Function of String.
> > Perfomance gain is from about 10% for a small string with few needed
> > compares to more that 300% for a string with 100 chars length that is
equal.
>
> One thing that I found while working on this function was that we often
> had mispredicted branches because of the
>
> if (...)
>    return false
>
> construct. One thing you might want to try is replacing that with:
>
> if (...)
> goto rfalse;
>
> ...
>
> rfalse: return false;
>
> Just doing that got me a fairly large boost on the existing code base.
>
> Also, please attach your benchmarks. I would like to be able to
> reproduce your numbers on my box.
>
> -- Ben
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: String.zip
Type: application/octet-stream
Size: 69701 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040704/42997ecc/attachment.obj 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: PatchStringEquals.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040704/42997ecc/attachment.txt 


More information about the Mono-devel-list mailing list