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

Ben Maurer bmaurer at ximian.com
Sat Jul 3 20:25:20 EDT 2004

(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 

More information about the Mono-devel-list mailing list