On Sun, 29 Feb 2004 10:20:17 +0200, "Sims" <si*********@hotmail.com> wrote:
I proud myself in having good comments, (/**/, // etc...), all over my
scripts as well as a very descriptive section at the beginning of the
script.
No correct me if i am wrong but php must still 'read' those comments?
So, do comments technically slow the whole process?
Or is the loss of CPU/Time/memory so negligible that i do not need to worry
about it.
I really would not worry about it. It makes the file slightly larger, but
those comments are very valuable, and it's easy for the parser to skip them
anyway.
Just tried an artificial scenario with one file having just an echo, and the
other file having the same echo but 20k of comments. Came out with this:
Benchmark: timing 500 iterations of comments, nocomments...
comments: 43 wallclock secs ( 0.24 usr + 0.84 sys = 1.08 CPU) @ 462.53/s
(n=500)
nocomments: 43 wallclock secs ( 0.29 usr + 0.63 sys = 0.92 CPU) @ 542.89/s
(n=500)
So the difference isn't exactly earth-shattering, and that's with about a
1500:1 comment-to-code ratio. Odds are you'll could make peformance increases
orders of magnitude greater by improving the algorithms in your code rather
than worrying about microseconds potentially saved by not having comments.
--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>