> At 09:42 24.11.2002, Adam said: > --------------------[snip]-------------------- > >I have always had the opinion that the more comments you put into php > >scripts, the slower they will run because there is more data to be read... > >Can someone tell me if there is any truth in this or whether commenting has > >absolutely 'no' impact on the performance of a script? > --------------------[snip]-------------------- > > As PHP is an interpreter it needs to scan every line and every token of > code as it runs it. Thus said, of course using comments takes more time to > execute than having no comments. > > I have no profiling yet how much having comments or blank lines would > actually effect execution times, but I doubt it would be really an issue > since PHP, once a comment start is encountered, doesn't parse the text but > just scans for the end-comment tag. >
Having comments within loops is no different than having comments anywhere else in your PHP scripts, comments are stripped out in the lexical analysis phase, and therefore, they don't even enter into consideration in the execution phase. If you're worried about the extra lex/io time on your scripts then (besides being a little insane :), you should just be using a cache like the PHP Accelerator or APC, which will make comments give you absolutely no performance hit. -Sterling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php