[Mono-dev] System.Reflection.Assembly::Load Performance?
Rodrigo Kumpera
kumpera at gmail.com
Wed Dec 9 09:38:11 EST 2009
On Wed, Dec 9, 2009 at 12:00 PM, Babbage Linden <babbage at lindenlab.com>wrote:
>
> The code I'm using for loading is:
>
> public Script(string class_name, byte[] class_data,
> ref long event_handlers)
> {
> Init();
> Assembly assembly = Assembly.Load(class_data);
> foreach (Type NewType in assembly.GetTypes())
> {
> if (NewType.IsSubclassOf(typeof(UserScript)))
> {
> UserScript userScript =
> (UserScript)assembly.CreateInstance(
> NewType.ToString());
>
> SetUser(userScript, ref event_handlers);
> return;
> }
> }
> }
>
>
This loop will consume a lot of resources as the runtime have to decode and
load all types in the assembly before returning it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091209/d2f0d09a/attachment.html
More information about the Mono-devel-list
mailing list