Issue Bug Closed

#24502[Performance] Speed up makeInstance() by caching getClassName() results

Christian Kuhn 01/09/11, 01:48 updated 03/29/11, 23:48

Description

This is an SVN patch request.

Type: Performance improvement

Branches: trunk

BT: http://bugs.typo3.org/view.php?id=16951

Problem:
Every makeInstance() call determines the ‘final’ class name by checking in getClassName() with class_exists() for ‘ux_’ classes.

Solution:
Add a very simple first level cache around the getClassName() call to look up already determined final class names in a local array for consecutive calls with the same class.

Notes:
The autoloader (which eats up most time of the class_exists() call) is pretty expensive but has some local caching as well. So, this patch is not as effective as it seems at first glance and just speeds up ‘a bit’. On a pretty native introduction package I was able to reproduce a gain for a full cached page between 0,5 and 1,5%, which is actually near to experimental standard deviation. Still, this patch can not make things slower.

(issue imported from #M16951)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.