Project

General

Profile

Actions

Bug #22158

closed

Replace calls to t3lib_div:: within t3lib_div to self:: du to performance reasons

Added by Nikolas Hagelstein over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2010-02-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

t3lib_div-self.patch (63.5 KB) t3lib_div-self.patch Administrator Admin, 2010-02-22 16:28
Actions #1

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.

Actions #2

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)

Actions

Also available in: Atom PDF