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

Okay, so my job at work is that I wrote about 200 lines of extra functions to the aspx page code, which is not currently implemented. It is in a routine that processes an event that currently has a zero chance.

Since this code is not used, I became curious. Should I comment on a subroutine that has a zero chance of firing? Would he do anything to improve page performance or something like that if I really commented on this? Or could I / just leave it as it is? Thanks in advance.

+6
performance comments
source share
4 answers

A few comments:

  • Performance is often quite unintuitive; there is no substitute for careful measurement.
  • Any compiled code in your address space consumes resources. So there may be some overhead. But how much compared to everything else? My assumption is very small or even insignificant, but see paragraph 1.
  • Unexpected things happen with the scale of the application, minor things can become important when they are copied several times. Therefore, prefer to keep things in order.
  • If you use a source control system, simply delete the code that was saved in the old versions in the repository. Keep your code in order. The commented code scares the maintainer.
+11
source share

Its unlikely that you will measure any significant differences if you drop a couple of unused methods. They will probably be weeded out as part of compiler optimization and may not even generate object code.

But useless code commented out or, of course, very scary (# 4 djna above)

+2
source share

I have no reason to believe that this will make any difference.

The only time I think it matters is if you had a lot of comments in HTML or something that really needed to be processed or rendered.

Why don't you try to register the execution time of a procedure that calls methods in the same file as the code that has been commented and not commented to check it?

+1
source share

if there is nothing that actually causes the code to be called, there is no need to comment on it.

Of course, it will be added to the assembly assembly, but this will not increase the performance of your web application.

+1
source share

All Articles