Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does having old commented code and a lot of whitespaces in code slow down performance?

Does having a lot of white space between chunks of code and empty lines in code slow down the performance of the application?

I have a tendency to space apart my code quite a bit, and I am wondering if it affects it negatively. Also, I have a lot of commented code that I commented out when I made changes, although I keep it around in case I ever have to go back to the old way. What are some other tips that could speed up performance?

like image 793
user1632018 Avatar asked Sep 07 '12 19:09

user1632018


People also ask

Can too many comments slow down your code?

Commenting will not affect the script execution time in normal case. But the number of lines you write in your code affect the parser to read and buffer it considerably.

Do comments in code affect performance?

The biggest effect that comments have is to bloat the file size and thereby slow down the download of the script.

Does commented code affect performance HTML?

What are the negatives of HTML comments? worsens the UX - even not visible, the HTML comments are part of the DOM tree and increase the number of DOM elements. This, in turn, affects the quickness and responsiveness, also leads to slower CSS selectors and DOM manipulation.

Do comments affect runtime?

Since comments have no impact on the runtime results, they are sometimes neglected when the source code is updated.


Video Answer


1 Answers

No performance degradation at all. Comments are not parsed by the compiler, they are usually removed in the lexical analysis.

like image 132
sanjosep43 Avatar answered Oct 19 '22 23:10

sanjosep43