[TYPO3-team-core-v5] hugh performance lack through massive file inclusion (500%)

Axel Hoogestraat a_hooge at web.de
Thu Apr 24 13:22:06 CEST 2008


Hello,

some time ago, i did a project, where i figured out, that inclusion of files 
is a big perfomance factor for php.
There is a big potential for flow3 to run much much faster.

In a quick test i figured out the following in flow3.

Everytime, class_exists(CLASSNAME) is called, the class of name CLASSNAME 
ist included via the spl_autoload_function.
I realized, that a call to http://localhost/TestPackage includes all classes 
from all other packages as well (PHPUnit, Testing and so on).

The reason is, that the F3_FLOW3_MVC_RequestHandlerResolver make this call : 
$this->componentManager->getAllImplementationClassNamesForInterface('F3_FLOW3_MVC_RequestHandlerInterface');
The called function checks all classes from all packages, if it exist, is a 
interface and/or abstract.

The following changes results in a 500% better performance (!), checked with 
ApacheBench.
Changeing the mentioned CodeLine to
$this->componentManager->getAllImplementationClassNamesForInterface('F3_FLOW3_MVC_RequestHandlerInterface', 
'F3_FLOW3_MVC');

And the method getAllImplementationClassNamesForInterface to that:
public function getAllImplementationClassNamesForInterface($interfaceName, 
$onlyInPackage = false) {
    ...
    if ((!$onlyInPackage || stristr($className, $onlyInPackage)) && 
class_exists($className)) {
        $class = new ReflectionClass($className);
    .....
}

So only the MVC Subpackage is checked for possible RequestHandlers.

AND: 500% was for my installation. And i only have checked out the FLOW3 
package. If you have Typo3, Typo3CR and, and, and in your package Folder, 
the perfomance difference might be greater.

Perhabs someone can try this litte change an post his results. And perhabs 
somebody can find a better solution, because the mentioned above seems a 
litte bit like a Workaround.

Greets
Axel 



More information about the TYPO3-team-core-v5 mailing list