[Mono-dev] [PATCH] Further improvements to toStringperformance

Eyal Alaluf eyala at mainsoft.com
Fri Mar 28 10:30:42 EDT 2008


Thanks Miguel, I'll commit the patch next week.

-----Original Message-----
From: Miguel de Icaza [mailto:miguel at novell.com] 
Sent: 27 March 2008 17:47
To: Eyal Alaluf
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] [PATCH] Further improvements to
toStringperformance

Hello Eyal,

     I have done a cursory review of this patch, and it looks good to
go.    Doing it now, will give it more exposure to people.


On Tue, 2008-03-25 at 06:05 -0700, Eyal Alaluf wrote:
> 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.


More information about the Mono-devel-list mailing list