Read Carefully
The question here is not that does PHP parser processes comments or not nor the question is about, that does omitting comments give more performance to your script or not!
Its about, that ” Does PHP parser spend a microtime while reading comments? “
Why I am asking?
Due to the misconception over Internet World regarding this question. Some programmers says ‘YES’ and some answers ‘NO’. Who should I obay ?
Edit: (After getting mostly comments and answer claiming to spend microtime on comments)
Look What I’ve got here
<?php
// Control
echo microtime(), "<br />"; // 0.25163600 1292450508
echo microtime(), "<br />"; // 0.25186000 1292450508
// Test
echo microtime(), "<br />"; // 0.25189700 1292450508
# TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
# .. Above comment repeated 18809 times ..
echo microtime(), "<br />"; // 0.25192100 1292450508
?>
Even if it takes some microseconds (yes it will, your file has to be parsed, right?!), you shouldn’t remove them. First thing to do is to cache the byte code, so the PHP interpreter doesn’t have to reparse the “plain text” code to byte code. I think you can get a lot more performance gain out of that, rather than worrying about comments taking up parse time.
It seems to be indeed a duplicate to this post. (Note to self, first refresh the page before submitting.)