[Mono-devel-list] [Patch] Manged code is fast!

Andreas Nahr ClassDevelopment at A-SoftTech.com
Thu May 20 18:57:39 EDT 2004


this is a first of a series of patches for the string class moving it to managed code. Why? Because it is faster than native!
------------------  Believe in managed code! ;)  -------------------------

Here are some microbenchmark results for the change (I think I made literally thousands of runs):
(002) is the number of chars tested with, first value is old time in ms, second value is time after change in ms.

CopyTo (002): 7190 -> 3595
CopyTo (015): 7611 -> 4446
CopyTo (016): 8982 -> 4486
CopyTo (512): 3174 -> 2995

ToCharArray (000): 4727 -> 4086
ToCharArray (002): 4967 -> 4556
ToCharArray (015): 8041 -> 7691
ToCharArray (960): 2674 -> 2673

ToCharArray (with parameters): Similar to above (little bit less)

Also I believe that we should be able to gain another 20% speed increase by further optimizing int-pointer casts and operations in the JIT/ Runtime.
Moreover one of the huge speed hogs is the creation of a new string object (which still needs an icall). If somebody would come up with a good idea to optimize this this would give us another serious speed gain for the string class. By the way: Does anybody know if creating a new string object in native using InternalAllocateStr initializes the allocated memory to 0 values? Because it doesn't need to.

I'm hoping for feedback on the patch...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040521/249f2c05/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: PatchStringTo.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040521/249f2c05/attachment.txt 

More information about the Mono-devel-list mailing list