[Mono-dev] patch for String equality/inequality
Marek Safar
marek.safar at seznam.cz
Fri Feb 17 18:12:21 EST 2006
Hello,
> I noticed that String operator != just reuses == i.e. a != b
> returns ! (a == b). It could be more effective if operator!=
> has actual implementation code. Also, string.Equals() currently
> calls operator!= which performs extraneous null check (maybe
> static invocation was faster?).
>
> As far as I tried with XMLmark, the attached patch certainly
> improves performance (though not big, about 2%). If it looks
> good feel free to apply to trunk.
>
I think it is not worthwhile to duplicate all code because of 2 %.
> I noticed that string op_Equality is slow, about 2x than MS.
> There might be chances to improve it.
>
I tried to optimize internal method used for Equality and here are
results of my string.Equal micro benchmark and patch (including both of
them).
Micro benchmark results for P-III - 1,13 GHz
Microsoft runtime v 1.1 - 41,47 sec
Microsoft runtime v 2.0 - 26,30 sec
Mono SVN HEAD - 44,00 sec
Mono SVN HEAD -O=all - 42,09 sec
Patched Mono SVN HEAD - 26,32 sec
Patched Mono SVN HEAD -O=all - 25,88 sec
Patch on Microsoft runtime v 2.0 - 21,65 sec
The last result I got when I tried to run my new code on Microsoft
runtime (MS JIT). The result is best of all which basically means that
we can still improve our JIT compiler ;-)
For test on Microsoft runtime I used csc with /optimize+ option and mcs
for Mono tests.
Any objections to the patch ?
- Marek
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: string.equal.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060217/16643653/attachment.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbench.cs
Type: text/x-csharp
Size: 646 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060217/16643653/attachment.bin
More information about the Mono-devel-list
mailing list