Re: [PHP] does //commenting reduce performance?

2002-11-25 Thread DL Neil
Jason,
ad infinitum, ad nauseum

However it was your recent post that (sig file) quoted the Freudian:
ontogency recapitulates phylogeny

We should make them become more like us
- even if we kill them in the process!
=dn


 On Sunday 24 November 2002 22:58, DL Neil wrote:
  Neatly done Ernest!
  Also in showing how these questions are best answered with five minutes
on
  the PC, than a msg to the list...

 ... until someone else comes along and asks a similar question and you
have to
 show them again how it's best answered with five minutes on the PC, than a
 msg to the list ... ad infinitum

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 Who's on first?
 */


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




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




[PHP] does //commenting reduce performance?

2002-11-24 Thread Adam
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?

Thanks,
Adam.



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Kyle Gibson
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?


The comments are ignored, except the characters that initiate the actual 
comment.

//some comment
$somevar=va;

some comment wouldn't even be looked at. PHP sees the //, and goes to 
the next line.

I suppose on a large scale this could reduce performance, but the 
performance that is lost in standard applications is minuscule.

One thing you might want to avoid is using comments inside loops.


--
Kyle Gibson
admin(at)frozenonline.com
http://www.frozenonline.com/


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



Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread DL Neil
Adam,

 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting
has
 absolutely 'no' impact on the performance of a script?


An answer proposed that there was little impact, but then suggested comments
not be used within loops (one presumes from this, the concern is that even a
little impact can mount up when repeated many times).

Why don't you run a microtime testbench to time a commented and an
uncommented loop, settle your mind, and report back with REAL information!?

Computer programming is the embodiment of 'write once, run many' manta.
Comments are no use at all during execution, but should be intended to be of
considerable assistance during the writing/maintaining phases. Never give
anyone an excuse for not writing (meaningful) comments - enough energy
already goes into creative excuses for that - and you may be the next to
suffer from some predecessor's arrogance! There are routines available which
take in a developer's script and output a comment-less, stripped-down for
maximum slipstream, dense code, version - ready for execution.

Regards,
=dn


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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Ernest E Vogelsinger
At 09:42 24.11.2002, Adam said:
[snip]
I have always had the opinion that the more comments you put into php
scripts, the slower they will run because there is more data to be read...
Can someone tell me if there is any truth in this or whether commenting has
absolutely 'no' impact on the performance of a script?
[snip] 

As PHP is an interpreter it needs to scan every line and every token of
code as it runs it. Thus said, of course using comments takes more time to
execute than having no comments.

I have no profiling yet how much having comments or blank lines would
actually effect execution times, but I doubt it would be really an issue
since PHP, once a comment start is encountered, doesn't parse the text but
just scans for the end-comment tag.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Ernest E Vogelsinger
At 12:58 24.11.2002, DL Neil said:
[snip]
Why don't you run a microtime testbench to time a commented and an
uncommented loop, settle your mind, and report back with REAL information!?
[snip] 

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  100; ++$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  100; ++$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  100; ++$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.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread @ Edwin
Hello,

Ernest E Vogelsinger [EMAIL PROTECTED] wrote:

 As PHP is an interpreter it needs to scan every line and every token of
 code as it runs it. Thus said, of course using comments takes more time to
 execute than having no comments.

 I have no profiling yet how much having comments or blank lines would
 actually effect execution times, but I doubt it would be really an issue
 since PHP, once a comment start is encountered, doesn't parse the text but
 just scans for the end-comment tag.

That said, it's reasonable to think that

//
//  I
//  have
//  long
//  comments
//  that
//  extends
//  hundreds,
//  if not,
//  thousands
//  of lines.
//  Just kidding! :)
//

  would be faster (unnoticeable it may be) than

/* -

 I
 have
 long
 comments
 that
 extends
 hundreds,
 if not,
 thousands
 of lines.
 Just kidding! :)

- */

Anyway, it's *always* better to have comments than nothing at all...

- E

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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread DL Neil
Neatly done Ernest!
Also in showing how these questions are best answered with five minutes on
the PC, than a msg to the list...


 At 12:58 24.11.2002, DL Neil said:
 [snip]
 Why don't you run a microtime testbench to time a commented and an
 uncommented loop, settle your mind, and report back with REAL
information!?
 [snip]

 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  100; ++$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  100; ++$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  100; ++$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.


 --
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/





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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread DL Neil
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  100; ++$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  100; ++$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  100; ++$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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Sterling Hughes
 At 09:42 24.11.2002, Adam said:
 [snip]
 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting has
 absolutely 'no' impact on the performance of a script?
 [snip] 
 
 As PHP is an interpreter it needs to scan every line and every token of
 code as it runs it. Thus said, of course using comments takes more time to
 execute than having no comments.
 
 I have no profiling yet how much having comments or blank lines would
 actually effect execution times, but I doubt it would be really an issue
 since PHP, once a comment start is encountered, doesn't parse the text but
 just scans for the end-comment tag.


Having comments within loops is no different than having comments anywhere else
in your PHP scripts, comments are stripped out in the lexical analysis phase, 
and therefore, they don't even enter into consideration in the execution phase.

If you're worried about the extra lex/io time on your scripts then (besides 
being a little insane :), you should just be using a cache like the PHP 
Accelerator or APC, which will make comments give you absolutely no performance
hit.

-Sterling

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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Ernest E Vogelsinger
At 16:10 24.11.2002, DL Neil said:
[snip]
However, if the Loop without
comment results make sense to you - you're a better man than I, Gunga Din!
[snip] 

I'd rather have my scripts crawl than having no comments in them *g*


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Vincent Vandemeulebrouck
 I have always had the opinion that the more comments you put into php
 scripts, the slower they will run because there is more data to be read...
 Can someone tell me if there is any truth in this or whether commenting
has
 absolutely 'no' impact on the performance of a script?

If the overhead of the parser removing comments becomes an issue for you,
you'll probably be in the situation where your application is heavy, with
thousands of scripts, and a lot of commenting everywhere.

As said before, the comments only impact the parsing. So, you just have to
implement a stripcomment script, that you run when you move your script
from your development server to your production server.

And anyway, this would not be significant, unless you recompile a custom PHP
version where you remove the comment parsing. This would be intereting if
your code was already optimized...

Vincent Vandemeulebrouck


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




Re: [PHP] does //commenting reduce performance?

2002-11-24 Thread Jason Wong
On Sunday 24 November 2002 22:58, DL Neil wrote:
 Neatly done Ernest!
 Also in showing how these questions are best answered with five minutes on
 the PC, than a msg to the list...

... until someone else comes along and asks a similar question and you have to 
show them again how it's best answered with five minutes on the PC, than a 
msg to the list ... ad infinitum

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Who's on first?
*/


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