[wp-hackers] Proposal for a function commenting convention

Travis Snoozy ai2097 at users.sourceforge.net
Sun Oct 14 08:20:11 GMT 2007


On Sun, 14 Oct 2007 02:56:11 -0500, Jacob <wordpress at santosj.name>
wrote:

> You have to post your code.

Attached (gzip'd file, test load + comments). Procedure:

1. Comments + test load
time php test.php > /dev/null

2. Just the test load
sed -r -i -e '/\*/D' test.php
time php test.php > /dev/null

3. Vs. a WordPress installation's generation times
I'd have to generate a test DB that was clean to send out for this to
be anywhere near comparable. I'm too lazy, but a default installation
with no posts and no plugins enabled would probably be a sufficient
milestone. I did NOT use an empty DB for my numbers.


> In theory, it does make sense that comments will have a minor impact
> on performance, however it shouldn't have that much impact. The
> characters would still have to be parsed up to the point where a
> clear guess could be figured. Up to the point where it can be
> gathered that the line is whitespace it would have to devote some
> time to figuring out what to do before it can skip it and move on.
>
> Much to the same reason why shorter variable names would have better 
> performance than longer ones. I very much prefer longer variable
> names and also very much prefer documentation over having none.

For that matter, a proper optimizing compiler + cache would do a whole
hell of a lot more for an installation than length tweaks, and would
also completely remove the comment issue on any responses served from
the cache. I'm certainly not arguing against inline documentation on
performance grounds -- I think that it's critical to start getting
test-grade PHPDoc-style API documentation in. I'm just pondering/
hypothesizing about whether those comments should be automatically
stripped from the deployment zip to improve performance on sites that
don't have (and especially ones that can't get) caching.



-- 
Travis 

In Series maintainer
Random coder & quality guy
<http://remstate.com/>


More information about the wp-hackers mailing list