Skip to content

Improve performance of ClassAliasLoader #2

@vertexvaar

Description

@vertexvaar

Abstract: The ClassAliasLoader adds unnecessary overhead if autoload_classaliasmap.php is holding no entries and the API is never used.

I set up a TYPO3 7.6.6 installation with the official bootstrap package and profiled the frontend request on the root page. Profiling proves, that 3.5 % of the whole request time is simply "lost" because of the class alias loading, which does not have any impact. This might sound negligible, but most TYPO3 installations i know have 10+ extensions. The more classes, the greater the impact. I also profiled some of these installations and i got results between 2 % and 4 % request time spent on class alias loading.
Not talking about percentages: The class alias loading is delaying the request from 2 to 14 ms.
BTW: The memory usage impact is insignificant.

I won't hold speeches about the importance of fast websites, user (dis-)satisfaction or else. Just let us fix this.

My proposal:
If both arrays are empty, the do not register the ClassAliasLoader, but add a factory callback or such instead of the instance to ClassAliasMap. At the moment the API gets called we can still resolve the ClassAliasLoader and register it as spl_autoload function.

A PR will follow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions