[development] coding standard question

Oleg Terenchuk litwol at gmail.com
Mon Aug 27 19:26:40 UTC 2007


I have been told numerous times that it is a big mistake trusting microtime
tests.

if you want to get /real/ run time results you need to use tools like
xdebug.

On 8/27/07, mark burdett <mfburdett at gmail.com> wrote:
>
> well,  it seems like coin tossing to me. But I haven't let it run all day.
>
> in this test, TRUE wins:
> mark at subtle ~/Sites % php pp/test.php
>   true: 1.26725101471  TRUE: 1.25381183624
>   true: 1.29299092293  TRUE: 1.26070404053
>   true: 1.27665114403  TRUE: 1.24824905396
>   true: 1.31866884232  TRUE: 1.25040316582
>   true: 1.27103209496  TRUE: 1.2434129715
>   true: 1.28510403633  TRUE: 1.24616312981
>   true: 1.29535198212  TRUE: 1.24373793602
>   true: 1.27827787399  TRUE: 1.22749304771
>
> in this one a tie:
> mark at subtle ~/Sites % php pp/test.php
>   true: 1.26420211792  TRUE: 1.24726390839
>   true: 1.25392603874  TRUE: 1.25495100021
>   true: 1.25082397461  TRUE: 1.24722003937
>   true: 1.25069499016  TRUE: 1.24976992607
>   true: 1.25077605247  TRUE: 1.247205019
>   true: 1.25090909004  TRUE: 1.25059509277
>   true: 1.30386614799  TRUE: 1.31354403496
>   true: 1.2652528286  TRUE: 1.25868320465
>
> TRUE wins another one:
> mark at subtle ~/Sites % php pp/test.php
>   true: 1.23990178108  TRUE: 1.21928906441
>   true: 1.22088694572  TRUE: 1.21982097626
>   true: 1.21747803688  TRUE: 1.22024011612
>   true: 1.21896100044  TRUE: 1.22330522537
>   true: 1.22763895988  TRUE: 1.2149310112
>   true: 1.21694612503  TRUE: 1.21505308151
>   true: 1.21890115738  TRUE: 1.21598815918
>   true: 1.21745586395  TRUE: 1.21514201164
>
> --mark
>
> On 8/27/07, Steve Rude <steve at achieveinternet.com> wrote:
> >
> >  You are outputting in seconds.  Sure .06 seconds doesn't sound like a
> lot,
> > but when you multiply that times 1000 to get milliseconds, it starts to
> look
> > more substantial...
> >
> >  1326ms vs. 1382ms is 60ms, and when normal page load times are
> somewhere
> > around 200ms, it makes a substantial difference.
> >
> >  Steve Rude
> >
> >
> >  mark burdett wrote:
> >  Hi, in some simple command-line tests I could not find a difference (in
> php
> > 5.2)
> >
> >  true: 1.32612895966 TRUE: 1.38275790215
> >  true: 1.34794092178 TRUE: 1.39009809494
> >  true: 1.34102320671 TRUE: 1.38674616814
> >  true: 1.2856991291 TRUE: 1.27452993393
> >  true: 1.34056401253 TRUE: 1.2749080658
> >  true: 1.31166195869 TRUE: 1.33323001862
> >  true: 1.34053897858 TRUE: 1.27428483963
> >  true: 1.28342199326 TRUE: 1.33444595337
> >
> > <?php
> > $loop = 0;
> > while ($loop < 8) {
> >  $count = 0;
> >  $start = microtime(true);
> >  while ($count < 4000000) {
> >  $test = true;
> >  if (true) {
> >  $count++;
> >  }
> >  }
> >  echo ' true: ';
> >  echo microtime(true) - $start;
> >
> >  $count = 0;
> >  $start = microtime(true);
> >  while ($count < 4000000) {
> >  $test = TRUE;
> >  if (TRUE) {
> >  $count++;
> >  }
> >  }
> >  echo ' TRUE: ';
> >  echo microtime(true) - $start;
> >  echo "\n";
> >  $loop++;
> > }
> >
> > --mark
> >
> > On 8/27/07, Karoly Negyesi <karoly at negyesi.net> wrote:
> >
> >
> >  I do not believe that true could be faster than TRUE when php is case
> > agnostic about its identifiers. Maybe there is time taken to lowercase
> TRUE
> > ... but if you can measure lowercasing four characters in the parsing
> stage
> > where only ASCII is supported, congratulations.
> >
> > About commas, yes the D5 menu defintiions are ugly sometimes. Have you
> seen
> > D6 :) ?
> >
> >
> >
> >
> >
> >
> > --
> >  Steve Rude + Lead Developer
> >  AchieveInternet
> >  (800) 618-877 x 202
> >
> >  http://www.achieveinternet.com
>



-- 
Oleg Terenchuk
Web Manager / Developer
Phone: 917 - 306 - 5653
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070827/d99909c2/attachment.htm 


More information about the development mailing list