Comments within code

php.internals

Oto Hlincik

23 years ago
Quick Question... How does a large amount of Comments within code (especially Class definitions) affect script performance? Thanks, Oto Hlincik

Derick Rethans

23 years ago
On Fri, 2 May 2003, Oto Hlincik wrote:
> Quick Question... > > How does a large amount of Comments within code (especially Class > definitions) affect script performance?
Not that much, it's mostly the reading of it that will take the most time. It can't be an excuse to not document your code ;) Derick
-- "my other box is your windows PC" ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ -------------------------------------------------------------------------

Ilia A.

23 years ago
On May 2, 2003 12:56 pm, Derick Rethans wrote:
> On Fri, 2 May 2003, Oto Hlincik wrote: > > Quick Question... > > > > How does a large amount of Comments within code (especially Class > > definitions) affect script performance? > > Not that much, it's mostly the reading of it that will take the most > time. It can't be an excuse to not document your code ;) > > Derick
If 40%+ of your total script size are comments you may see something like a 2-4% performance boost if you remove those comments for files >40kb. However, this should not be used as an excuse not to write comments and if you are using an opcode compiler the difference is NILL. However, if you absolutely must remove the comments & other useless white space. Before putting your script into a production enviroment run it via 'php -w script_name.php', this will strip out the whitespace and dump you the stripped file to stdout. Ilia

moshe doron

23 years ago
> Not that much, it's mostly the reading of it that will take the most
well, it's quite depended on the comments form[1] ;) [1] http://bugs.php.net/bug.php?id=23285
-- moshe