leepowers
leepowers

Reputation: 38308

PHP code comments parse speed

Does anyone have a solid benchmark about the speed of parsing PHP code comments? Meaning, will excessive comments increase the time to process a PHP page?

Upvotes: 8

Views: 1422

Answers (4)

Goose
Goose

Reputation: 4821

This user made a very thorough attempt to answer this question.

https://stackoverflow.com/a/42166652/3774582

The conclusion is that the difference is so negligible, that he was unable to find a measurable difference.

Upvotes: 0

Drew
Drew

Reputation: 6274

I could see someone wanting to strip comments to reduce the filesize when downloading the PHP page to the user, but you'd have to really have comment diarrhea to make that worthwhile, and if you have comment diarrhea your code is probably too hard to read on its own and stripping all the comments would screw the next person to look at it, so...

Upvotes: 1

N 1.1
N 1.1

Reputation: 12524

Useless optimization

b. strip off comments to speed up code

Not a solid benchmark, but this particular post has great PHP performance tips and some mythbusters.

Upvotes: 8

JonnyLitt
JonnyLitt

Reputation: 773

Comments are not parsed in PHP but rather ignored and PHP skips over them, in excess they only add to your diskspace. Otherwise, comments do not lag down processing at all.

Upvotes: 1

Related Questions