Thomas Carlton
Thomas Carlton

Reputation: 5968

What is faster, having multiple classes in the same file or each file for a group of classes?

I'm creating a big .Net project and I have the choice of creating multiple classes in the same Library or Creating different libraries each for a small group of classes.

The second option, is the one I'm doing so far because it helps me efficiently organize and split the project to small parts.

Now, the question is Performance. I would like to know if it's the same thing in terms of runtime performance.

Of course, in terms of loading the DLL files, having more files implies more time, but once all the files loaded, is there any difference ?

Thanks.

Upvotes: 3

Views: 229

Answers (1)

Szymon
Szymon

Reputation: 43023

I don't think there will be a difference in performance once the assemblies are loaded into memory.

One point to notice is that depending on how your application is used, not all the functionality may be used every time. If you have more granular assemblies, it may turn out that some of them don't need to be loaded at all and your memory usage may get lower.

Another point is that splitting into assemblies is also a design decision based on clear division in layers/modules, etc. It may also turn out that you need to split assemblies because of project dependencies. There are multiple factors impacting that.

Upvotes: 3

Related Questions