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 referen开发者_Python百科ce 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?
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).
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.
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.
精彩评论