Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any performance considerations from referencing a 5MB .Net assembly?

Today a co-worker mentioned he had issues with a large "enterprisey frameworky" project that when compiled was 5mb in size. The concern was that to use a even a small piece of functionality of the assembly you had to reference the entire thing and that is bad for some reason.

I'm wondering if there are any performance or other disadvantages from loading such a big assembly in a website deployment hosted on IIS?

like image 668
John Farrell Avatar asked Feb 23 '10 01:02

John Farrell


3 Answers

The first time a type is used, the assembly will be loaded. Loading 5MB from disk does have a performance cost (although this is not huge). Also, the assembly will stay in memory for the life of the AppDomain, so there's a bit of memory cost (again, not huge).

like image 59
Reed Copsey Avatar answered Oct 31 '22 11:10

Reed Copsey


Don't optimise using anecdotal evidence. Get some hard numbers and then determine whether the problem exists for you.

Generally I'd say that its not a problem for me anywhere - but I don't download these assemblies on demand via HTTP over unreliable links, on a server with low memory - your use case may be different.

like image 27
Preet Sangha Avatar answered Oct 31 '22 10:10

Preet Sangha


The major disadvantage is resource consumption; that .DLL stays in memory as long as the program is executing. 5MB isn't actually all that bad, though... System.dll alone, for example, is 3MB.

like image 40
Randolpho Avatar answered Oct 31 '22 09:10

Randolpho