开发者

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

开发者 https://www.devze.com 2022-12-21 10:12 出处:网络
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 as

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号