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

Andreas Nahr ClassDevelopment at A-SoftTech.com
Thu Jan 3 17:25:48 EST 2008


> 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 the
pointers and unsafe code for accepting the pointer.
The scheme is pretty straightforward (compare Char or CultureInfo):
Runtime:
* Pregenerate the table data
* convert to a C constant array
* embed that into the runtime (e.g.
http://anonsvn.mono-project.com/viewcvs/trunk/mono/mono/metadata/culture-inf
o-tables.h?rev=88796&view=auto)
* Create one runtime method to return a pointer to the array
Classlib:
* 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 no
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 cost
of the current suggestion (Managed already has a high startup cost and this
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 works
now, but back then it didn't (as far as I can remember).
A starting point MIGHT be Assembly.GetManifestResourceInternal




More information about the Mono-devel-list mailing list