[wp-hackers] Inline Documentation Effort was a Failure

Jacob Santos wordpress at santosj.name
Wed May 28 04:22:15 GMT 2008

Matt wrote:
> On Tue, May 27, 2008 at 8:39 PM, Stephen Rider
> <wp-hackers at striderweb.com> wrote:
>> I think that removing the documentation from the regular download would
>> discourage new people who are just learning to code.  How many people just
>> starting out will open up a file, see a bunch of dense code with NO
>> commenting, and say "forget it"?
> I wasn't really "voting" any which way, just stating that no matter
> how efficiently PHP handles comments, it'll never be as efficient as
> without comments.

You are both wrong and right at the same time Matt. The short and sweet 
of it is that you'll gain more optimizing or removing functions then you 
would ever see removing functions from code. Read below for why.

There is currently no way to benchmark code with or without comments, 
because comments are stripped out during the first stage of PHP, 
performance tests will only benchmark the second stage.

Interesting enough, one application (OpenX, was OpenAds, was PHPAdsNew), 
did notice a 20% performance increase. They went from 100 milliseconds 
to 80 milliseconds or something along that by stripping out all spaces, 
tabs, duplicate new lines and combining files by way of a build script.

You must pardon my lack of interest from gaining 20% when the actual 
numbers really don't matter. If you ask my opinion, it was merely 
coincidence and by from my benchmarks, include/require-ing a file takes 
up most of the time anyway. What they might had attributed to removing 
all comments and white space might had been just combining all of their 

As I've said, comments are stripped out during the first stage of PHP, 
as well as newlines. Actually, everything is compiled into bytecodes 
(opcodes, whatever) and then run. As I've said before, you can't 
benchmark that within PHP (nothing I've seen says that even XDebug 
benchmarks it).

Therefore it is an impossibility to have accurate numbers. What you have 
is a theory and an accurate one. Parsing comments out does take time 
that wouldn't be needed, however if you were to ever notice a 
difference, it is either, because they copied the contents of two 
volumes of books into the source either kick ass documentation or just 
for the fun of it.

For all that PHP does: opening files, reading files, interpreting 
(parsing), compiling, and then executing, it does a really quick job.


Jacob Santos

http://www.santosj.name - blog
http://funcdoc.wordpress.com - WordPress Documentation Blog/Guide Licensed under GPLv2

Also known as darkdragon and santosj on WP trac.

More information about the wp-hackers mailing list