Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

vb.net

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.

like image 917
Thomas Carlton Avatar asked Jan 18 '26 13:01

Thomas Carlton


1 Answers

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.

like image 90
Szymon Avatar answered Jan 21 '26 06:01

Szymon