开发者

What effect does an addition of an assembly have on an application?

开发者 https://www.devze.com 2023-01-16 15:23 出处:网络
If I add an assembly, what effe开发者_StackOverflow中文版ct does it have on my application? Does one assembly makea big difference in footprint or runtime performance? Does an unused assembly get disc

If I add an assembly, what effe开发者_StackOverflow中文版ct does it have on my application? Does one assembly makea big difference in footprint or runtime performance? Does an unused assembly get discarded at some point in compilation?

Thanks


The assembly is listed in the manifest of the referencing application. There is a very small overhead from this 'administration' alone. An assembly will only be loaded (piece by piece) when needed, but the compiler/linker will not remove an unused assembly.

The main consequence for referencing an assembly but not using it is that it will have to be present when the app starts.


Yes, it make a difference. It makes the cold-start of your app slower. When you haven't run your app before, like a couple of minutes ago so the DLL is in the file system cache, the hard disk has to find the DLL back so that the CLR can load it. The time needed for that is remarkably constant since I started measuring it, about 50 milliseconds to find a file. Hard disks get bigger and faster, but the time needed to find a file is one divided by the other and consistent. Ignoring SSDs.

It's a human time measure, not a machine measure. How long is your user willing to tap her foot to get your program going. Very subjective, a program that doesn't do much at all taking one second is too much. A program that does a lot displays a pretty splash screen, like Visual Studio, something to keep you occupied for the next 5-some seconds. At first.

You can use ILMerge to fight back the tapping.

0

精彩评论

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