tags:

views:

34

answers:

1

Hi,

If I add an assembly, what effect 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

+1  A: 

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.

Hans Passant
Hans, I thought so but can you confirm that all files are opened on startup? And are you sure you can get a Splash to run before that is completed?
Henk Holterman
@Henk, the JIT compiler has a mind of its own. It doesn't need to load an assembly until really needed to compile and execute code. Giving lots of leeway to get your app to boot up faster. Overlapping that with the `user experience` is an art. That's why they pay us the Big Bucks.
Hans Passant
@Hans: Yes, I just found it out for this related question http://stackoverflow.com/questions/3749942/can-i-use-a-library-which-references-an-unavailable-assembly-if-its-not-used
Henk Holterman