views:

55

answers:

2

I'm using c#. In many cases I'm writing code that can benefit from a very simple class/method located in a "non-relevant" dll. For example, I'm writing some algorithm with no UI but it can benefit from a Point class in System.Drawing, or I need some xml manipulation method from System.Web even though I'm writing a console app (these are just examples).

Besides the "code smell" - is there a performance penalty for importing a big assembly for a small chunk of functionality?

+2  A: 

Yes, there is a performance penalty associated with loading assemblies (e.g. loading assemblies require verification and occupies address space from your process), but it may not be significant, so you should check how it affects your application. Most likely it will not be a big issue.

Brian Rasmussen
+2  A: 

Not really. The size of the assembly does not matter, so it's just 1 DLL extra. You probably already have between 10 and 30, and loading 1 extra is very cheap.

Henk Holterman