Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
My source code is of size 8Gb in that lots of commented code is there.The application is also slow so if i delete the commented code can i increase the performance??

Where can i check for the performance road blocks??
Posted
Comments
George Jonsson 28-Oct-14 5:10am    
Commented code will not be executed, so it won't slow down your app.
Start with looking for loops in the code.
Add a Stopwatch and measure the time it takes for code blocks you suspect might take a long time. Then you can start to make the code more efficient.

No ! Comments do not effect execution speed of a program. Particularly in C#, comments are not parsed to the compiler. They are eliminated in the lexical analysis.

But, do not keep commented files which are not necessary. The main purpose of comment should be document your code. Although, it has nothing to with the performance of your application/program.

You can check this is using IL Disassembler[^].

I hope it was helpful and incase any further clarification required on this topic please reply :)
 
Share this answer
 
Comments have no effect on runtime performance since the compiler ignores them.

If you have 8gb of .net source code then your problems are far greater than performance.

Start by zooming in where your users say the system is slow with the use of a profiler and work on the bits that take most time (this presumes that you have written your algorithms correctly, which most of them time by reworking how you do things you can gain ~10x+ time more performance than micro optimizing methods).
 
Share this answer
 
 
Share this answer
 
v2
I don't think there will be any performance degradation due to more comments.
Comments are not parsed by the compiler, they are usually removed in the lexical analysis.

Modern compilers e.g .net framework compiler will remove the white spaces and other comments and punctuation while compiling your code.

This process is also called tokenization which removes all unwanted stuff from your code before compiling. It will not remove them physically but do not consider them for compilation.


You can check with FireFox browser installing YSlow plugin to get some tips on checking and enhancement of performance of your application.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900