[Mono-devel-list] [PATCH] String speedup

Ben Maurer bmaurer at users.sourceforge.net
Sun Feb 22 12:51:49 EST 2004


Hello,

The following patch does some speedups for string operations. There are
two optimizations:

      * String.Equals -- Two things here. First, we use pointers rather
        than the string indexer. This allows us to avoid Array Bounds
        Checks. The second is that when possible we compare things one
        int at a time. This basically gives a doubling of perf from the
        above change. Thanks to Miguel for pointing me out to this
      * StringBuilder.Append (char []) -- Rather than setting char by
        char, I added an icall so we can use memcpy

Now, for what you have all been waiting for, numbers:

Test -------+ Before ---+ After ---+ Improvement factor +
Equals      | 6.797s    | 1.933s   | 3.516              |
Append      | 53.324s   | 8.242s   | 6.469              |
------------+-----------+----------+--------------------+

The test is attached.

-- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: corlib-string-speedup.patch
Type: text/x-patch
Size: 5319 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040222/023bd993/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mono-string-speedup.patch
Type: text/x-patch
Size: 2474 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040222/023bd993/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.cs
Type: text/x-csharp
Size: 749 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040222/023bd993/attachment-0002.bin 


More information about the Mono-devel-list mailing list