Ernest,

> Some time ago I've made myself a framework for such tests and have run it
> against a commented loop. This test was run on a dual PIII/1000 Dell
server.
>
>     $hpr = _fwx_profile_start('Loop with end-of-line comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         $a += 1;        // this is an end-of-line comment
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
>     $hpr = _fwx_profile_start('Loop with inline comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         /* this is an inline comment */ $a += 1;
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
>     $hpr = _fwx_profile_start('Loop without comment', true);
>     for ($i = 0; $i < 1000000; ++$i) {
>         $a += 1;
>     }
>     _fwx_profile_end($hpr, $i);
> Average time per loop: 0.059 msec
>
> Conclusio: I didn't find any measurable difference in these loops, be it
an
> end-of-line comment, an inline comment, or no comment.


=Apologies: I hit 'Send' on the preceding msg, even before signing off...
Duh!

=I have a similar test bench/frame, but which only puts out microtime
differences. My personal/dev PC is an Armada portable with 266MHz processor
and so is considerably more modest than your own beastie.

=I find that because the wee beastie is running PHP, Apache server, MySQL
server, etc, etc; that multiple runs of the same code can yield considerable
differences in execution time - see also warnings in manual, eg 'caching'.
Accordingly I run six cycles and record the last three:

=Herewith:
End of line comment: 4.3118, 4.415713, 4.342078
Inline comment: 4.331843, 4.403446, 4.339082
Loop without comment: 4.415728, 4.399776, 4.420114

=however a quick analysis shows that the fastest-slowest differences are:
.104, .072, and .021 (secs, resp)

=the differences between test types run to:
slow end: .012, and .017
fast end: .020 and .068

=In other words, apart from the first set of tests, any and all differences
are insignificant/disappear into 'noise'. However, if the "Loop without
comment" results make sense to you - you're a better man than I, Gunga Din!

=Concur completely with your own analysis,
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to