Bug #22158
closedReplace calls to t3lib_div:: within t3lib_div to self:: du to performance reasons
0%
Description
Currently t3lib_div uses t3lib_div:: to refere to itself statically.
Self:: is 8% to 10% faster than using classname:: due to the fact that no scope resolution has to be performed.
See:
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/Zend/zend_API.c?view=markup
Line(2154 to 2164).
Minitest:
class Test {
public static function a() {
Test::c();
}
public static function b() {
self::c();
}
static function c() {
$a = 1;
}
}
$interation = 100000;
$timeStart = microtime();
for ($i = 1; $i <= $interation; $i++) {
Test::a();
}
$timeEnd = microtime();
$time = $timeEnd - $timeStart;
echo $time . ' seconds -> ' . $interation . 'x Test::c <br />';
$timeStart = microtime();
for ($i = 1; $i <= $interation; $i++) {
Test::b();
}
$timeEnd = microtime();
$time = $timeEnd - $timeStart;
echo $time . ' seconds -> ' . $interation . 'x self::c <br />';
?>
(issue imported from #M13611)
Files
Updated by Benni Mack over 14 years ago
I had the same change in mind (and on my list). Glad you took care of it.
Could you send the patch to the core list? Thanks.
Updated by Benni Mack over 14 years ago
Committed to trunk (rev. 7043).
Committed to TYPO3_4-3 (rev. 7044) (I got the OK from Olly)