[TYPO3-dev] FYI: comparing execution speed of some php functions
Steffen Kamper
info at sk-typo3.de
Sun Jun 28 16:59:24 CEST 2009
Hi Niels,
no - it'S a different issue.
I tried with adding this to Rupi's script:
$GLOBALS['myClass'] = new mytestclass();
$S = microtime(TRUE);
for ($i = 0; $i < $num; ++ $i) {
$GLOBALS['myClass']->testfunc(1);
}
$E = microtime(TRUE) - $S;
echo "global object call took \t" . number_format(floatval($E * 1000),
5) . " ms\n";
these are the results:
calling methods in classes:
---------------------------------------------
object call took 347.18299 ms
derived object call took 359.87806 ms
static call took 523.85497 ms
global object call took 375.33998 ms
(oh god, my numbers are 8 times slower than Rupis, what's wrong with my
machine?)
but, after isolating the object calls (removing all other tests) i got
incredible different results:
object call took 0.02289 ms
derived object call took 0.01001 ms
static call took 0.00811 ms
global object call took 0.00811 ms
and this is completely the other way showing that static class calls are
faster than object calls.
As this example shows, don't trust results before you did an isolate
test. The performance of php completely change after filling memory etc.
vg Steffen
More information about the TYPO3-dev
mailing list