[Mono-devel-list] [PATCH] String speedup
Torstensson, Patrik
patrik.torstensson at intel.com
Sun Feb 22 18:32:26 EST 2004
Hi Ben,
The icall must use the memmove instead of memcpy because problems with
overlapping memory blocks (see
http://www.mail-archive.com/mono-list@lists.ximian.com/msg05275.html)
Otherwise it looks okay.
Cheers,
Patrik
-----Original Message-----
From: mono-devel-list-admin at lists.ximian.com
[mailto:mono-devel-list-admin at lists.ximian.com] On Behalf Of Ben Maurer
Sent: den 22 februari 2004 18:52
To: Mono Development
Subject: [Mono-devel-list] [PATCH] String speedup
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
More information about the Mono-devel-list
mailing list