[Mono-dev] [SPAM] Re: [SPAM] Re: ToString() performace in Mono revisited

Eyal Alaluf eyala at mainsoft.com
Sun Jan 6 09:34:15 EST 2008

Hi, all.

I have attached a patch following Andreas suggestions below. Please
review, especially the metadata part.

I saw once that Mono checks compatibility of Mscorlib with the runtime,
is this happenening automatically whenever an internal call is added?

BTW, since now the numberFormatter tables become arrays of magic numbers
in mono/metadata, is there a place where I should put the program that
generates these numbers?

Thanks, Eyal.

-----Original Message-----
From: Andreas Nahr [mailto:ClassDevelopment at A-SoftTech.com] 
Sent: 04 January 2008 00:26
To: Eyal Alaluf; 'Andreas Nahr'; 'Prakash Punnoor';
mono-devel-list at lists.ximian.com
Cc: 'Atsushi Eno'; 'Miguel de Icaza'; 'Juraj Skripsky'
Subject: AW: [SPAM] Re: [Mono-dev] [SPAM] Re: ToString() performace in
Mono revisited

> It does make sense to make the 'DblExpTab' common to all appdomains.
> How do you implement such a scheme in Mono? Is it possible to 
> achieve this without going out to unsafe code and internal methods?

Afaik to gain all the advantages you need one internal method to return
pointers and unsafe code for accepting the pointer.
The scheme is pretty straightforward (compare Char or CultureInfo):
* Pregenerate the table data
* convert to a C constant array
* embed that into the runtime (e.g.
* Create one runtime method to return a pointer to the array
* Define internalcall to the runtime method
* Store the retrieved pointer in a static variable
* Use the pointer as you would use the array (syntax is compatible, so
need to change the code)
* Get Array-Bounds-Check-Removal for free :)

> If the above is complicated, do you think that it makes sense 
> to consider the above as a separate task since the array size 
> is now 24K and a scenario with 1000 domains is a rare scenario?

Well I personally am much more concerned about the additional startup
of the current suggestion (Managed already has a high startup cost and
is measurably increasing it) than the additional memory cost. But not
everybody will think that way...
So imho it would be worth implementing in the runtime.
Greetings Andreas

P.S. WAY back then I tried to do the same without runtime support by
acquiring a pointer to an embedded resource file. I don't know if this
now, but back then it didn't (as far as I can remember).
A starting point MIGHT be Assembly.GetManifestResourceInternal

-------------- next part --------------
A non-text attachment was scrubbed...
Name: NumberFormatter.zip
Type: application/x-zip-compressed
Size: 46673 bytes
Desc: NumberFormatter.zip
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080106/c7c8b95b/attachment.bin 

More information about the Mono-devel-list mailing list