2

Is it better to merge all your code into one dll file or is it better to create separate projects for each namespace, for instance? I don't think it'd harm code's readability in any way as the code is separated in namespaces.

My question is:

How does the size of a library harm performance?

daralim
  • 183
  • 10
  • 1
    Having lots of projects will cause some overhead, but negligible in terms of performance. It will though cause cognitive overhead, and potential problems like more chances of circular references. – stuartd Oct 10 '17 at 10:38
  • 1
    [Big assembly and performance](https://stackoverflow.com/q/337144/1997232). – Sinatr Oct 10 '17 at 11:21
  • Thanks @Sinatr, that's exactly what I was looking for! – daralim Oct 10 '17 at 11:25

1 Answers1

1

It depends but generally it will affect your application at the initial load. In scenarios where you have dependency injection, the DLL loading will take longer as the dependency injection tool has to do a bit of work to figure things out.

In regard to explicit dependencies where your application directly references another project or component, performance is hurt on application load but shouldn't affect performance otherwise by its presence. All this of course doesn't account for what's actually in the DLLs as whatever work they do and their size will also increase load time.

There is also the possibility that your application has plug-ins which will decrease performance when they're loaded. When that happens is up to you application however.

DiskJunky
  • 4,750
  • 3
  • 37
  • 66
  • So is it better to create multiple DLLs for each topic/namespace and then let user to add them as references separately? – daralim Oct 10 '17 at 10:52
  • That's a difficult one to answer as it comes down to the individual needs of your application. In situations where the application is small and performing a specific task, then having just one exe is enough. The larger your application is, the more likely that it makes sense to separate it out into different components and libraries. This is especially the case where you want to re-use code in multiple places. The overhead for loading a DLL is quite small given the maintenance benefit it brings to the project overall - particularly on large applications – DiskJunky Oct 10 '17 at 10:54