[TYPO3-v4] autoloader and path

Christian Kuhn lolli at schwarzbu.ch
Tue Jan 4 21:13:30 CET 2011


Hey.

On 01/04/2011 03:28 PM, Steffen Kamper wrote:
> i see this pattern often in ext_autoload to determine the path:
>
> $extensionPath = t3lib_extMgm::extPath(extkey);
>
> As the autoloader reads this file and expects an array, this file should
> be cheap. Imagine 100 requests to autoloader with makeInstance. This
> would be 100 times calling t3lib_extMgm::extPath. Even this function is
> static and small, this can be prevented by using
>
> $extensionPath = dirname(__FILE__);
>
> (__DIR__ is php >=5.3 only)
>
> I suggest to use this pattern instead which makes it a lot faster.
> Your opinion?

Unnecessary: Benching a introduction package page, this 
t3lib_extMgm::extPath() is only called 7 times, kcachegrind tells that 
this is one of the cheapest methods which adds only 0.07% (!) to the 
overall computation time (of a full cached page).

So, this call is already very cheap (24 ns for a page which took 30ms to 
render on my system), any optimization just makes the call more ugly, 
circumvents our API and is useless performancewise, -1 for this idea.

BTW: I did some benchmarking of a vanilla 4.4 in comparison with a 4.5 
introduction package, I've already gathered some data, but I'm still far 
away from a real conclusion (it's a lot of work), just some minor bits 
(for full cached pages):
- makeInstance() and it's child methods are expensive (>15%), as we 
probably can not strip it down very much, the only solution is to call 
it less often (eg. the preparedStatement stuff was added in 4.5 
instantiation costs ~5% parsetime). I'm unsure about a real and better 
sophisticated solution but will think about alternatives.
- There are some t3lib_div methods which are called pretty often and 
which could benefit if we optimize them: getIndPEnv (5%), trimExplode 
(4%). There are some others which come into the game if the page is not 
cached (eg. the html-tag-dissasembler methods).

I'll try to come up with a better analysis soon, but can't promise too 
much for the upcoming two weeks.

So long
Christian


More information about the TYPO3-project-v4 mailing list