[Mono-dev] [PATCH] Further improvements to toString performance
Eyal Alaluf
eyala at mainsoft.com
Tue Mar 25 09:05:01 EDT 2008
Hi, Miguel.
The attached patch contains further improvements to the perf or ToString
of primitive types.
The perf gain is due to two changes
1. An instance of NumberFormatter is placed as a member of the Thread
class. This allows reuse of the character array within the NumberFormat
class and to cache the lookup of the NumberFormatInfo from the current
culture which turns out to be a costly operation.
2. The default ToString of integers has been specialized (because of
its simplicity).
The results of these improvements are:
10,000,000 * 12345.ToString(): From 13.0 Secs to 6.3 Secs
10,000,000 * 12345.ToString("G"): From 14.7 Secs to 8.4 Secs
10,000,000 * 0.12345.ToString(): From 27.9 Secs to 21.3 Secs
The results were made on my (a bit outdated) PC but the same
improvements were seen in newer types of machines.
I have also added the copyright and license notice.
Waiting for your approval, Eyal.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ToString.diff2
Type: application/octet-stream
Size: 46044 bytes
Desc: ToString.diff2
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080325/0aa5d0ac/attachment-0001.obj
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT486658.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080325/0aa5d0ac/attachment-0001.txt
More information about the Mono-devel-list
mailing list