Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does using namespaces affect performance or compile time?

Tags:

c#

.net

If I put all classes of a project in the same namespace all classes are available everywhere in the project. But if I use different namespaces not all classes are available everywhere. I get a restriction.

Does using namespaces affect the compile time somehow? Since the compiler has less classes in each namespace and not all namespaces are used all the time he may have a little less trouble finding the right classes.

Will using namespaces affect the applications performance?

like image 407
TalkingCode Avatar asked Jul 21 '11 10:07

TalkingCode


1 Answers

It won't affect the execution-time performance.

It may affect the compile-time performance, but I doubt that it would be significant at all, and I wouldn't even like to predict which way it will affect it. (Do you have an issue with long compile times? If so, you may want to try it and then measure the difference... otherwise you really won't know the effect. If you don't have a problem, it doesn't really matter.)

like image 178
Jon Skeet Avatar answered Oct 21 '22 16:10

Jon Skeet