Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will commenting-out unused code give my page a performance boost in any way, shape, or form?

Okay so my situation at work is that I've written about 200 or so lines of additional functionality into an aspx page's code-behind that is currently not to be implemented. It is in a subroutine that handles an event that currently has zero chance of occurring.

Because this code is not being used, I've gotten curious. Should I comment out the subroutine that has zero chance of firing? Would it do anything to enhance the performance of the page or anything like that if I did indeed comment it out? Or could/should I just leave it as is? Thanks in advance.

like image 543
KSwift87 Avatar asked Aug 02 '10 13:08

KSwift87


1 Answers

A few comments:

  1. Performance is often quite unintuitive, there's no substitute for careful measurement.
  2. Any compiled code in your address space consumes resources. So there might be some overhead. But how much relative to everything else happening? My guess is very little or even negligible but see item 1.
  3. Unexpected things happen as applications scale, negligible things can become important when they are copied multiple times. So prefer to keep things tidy.
  4. If you are using a source code management system then simply delete the code, it's saved in the old versions in the repository. Keep your code tidy. Commented-out code scares the maintainer.
like image 92
djna Avatar answered Sep 18 '22 12:09

djna