Do Comments Increase Execution Time?

Do Comments Increase Execution Time?

No. Comments have no effect on execution. They will slow the compiler down a tiny bit - but even that should be imperceptible unless you have a ridiculous number of comments. The "effect" you're noticing is more to do with the way you're timing things - using System.

Do comments affect run time?

So no, comments do not slow down the programs at run-time.

Do comments affect the execution of a program?

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.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.