Reputation: 815
The application I was brought in uses around 250 dlls(all visual studio components) and I noticed that there's a ton of comments that don't need to be there(from upgrading code from vb6 -> .NET) and many unused variables.
The amount of comments per solution can be as low as ~100 lines to as high as ~1000 lines of unneeded comments. Some solutions have upwards of 50 unused variables. This will increase the size of the DLL associated with that solution, would it not? Could this be affecting performance due to large number of useless code?
Upvotes: 0
Views: 110
Reputation: 942000
The .NET tool-chain and runtime are far too sophisticated to let dead code affect runtime performance. Aggressively micro-optimized by Microsoft. Something programmers should rarely do, but Microsoft routinely does because they got picky customers and they can never really predict in which unusual ways their customers will use their software.
Comments are removed completely by the VB.NET compiler. Might affect compile time but the effect is very small. Comments are very easy to parse. You'd need megabytes of them before you'll notice a slowdown.
Unused variables are removed by the jitter optimizer. Simply by there not being any code that actually uses them. They do occupy space in the metadata of a .NET assembly, growing the size of the file. Again a very small affect, you'll have a few more page faults at jitting or reflection time. You'd need tens of thousands of them to notice any effect.
So, nothing to worry about. Never remove useful comments. Removing dead code is something worth pursuing, just because it makes code easier to maintain.
Upvotes: 2
Reputation: 11430
They basically increase compile time. And If compiled into release build, the useless stuff will be stripped away. In debug build, the unused variables will be retained so that you can break at those points.
Upvotes: 1