Re: 1 last error to fix before the application is done!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Ballard wrote:
I've heard that a lot, but I just don't see it. I'm sure some of you
can come up with better tests than this, but here is what I used:

...
Based on these results, I'd hardly use the "language construct versus
function call" optimization argument to make my decision. I'm not sure
if this is a testament to improvements in the PHP engine over the last
couple years, or if equipment has gotten fast enough that the
differences have become irrelevant. Quite possibly, it's both.

There are a couple of issues with those benchmarks...
1. It uses rand()... this is generally a bad thing in benchmarks
2. It uses internal (wall clock) timing and tests different things in the same application run.
3. 50k iterations is easy! Give it something hard :)

You should really use an external timing function (like "time blah" on *nix) as it shows you real processor time used, as well as wall-clock time.


I've posted a simple benchmark else where on this thread that tests which prove that for a two index-depth test, !empty is approx 4.5x faster than the equiv array_key_exists tests.

Even for a single depth array test, I still get ~3x speed improvement using empty() vs. array_key_exists().

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux