[TYPO3-core] RFC #17489: [Performance] Improve t3lib_extMgm::addToAllTCAtypes performance

JoH asenau info at cybercraft.de
Thu Feb 10 13:19:42 CET 2011


This is an SVN patch request.

Type: Performance improvement

Branches: 4.5 and trunk

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

Problem:
Almost 40% of a BE AJAX call is consumed by 
t3lib_extMgm::addToAllTCAtypes().

This method should be improved performance-wise, if possible.

Solution:
Attached patch changes the most obvious things.

It removes preg_replace where it was not necessary.
It replaces strstr with strpos.
It optimizes the order of conditions in if clauses
and replaces some strpos checks with $item{0} == '-'

While profiling different versions of patches Steffen G., Jigal and me 
found out that a replacement of a foreach loop with approriate array 
functions slows down the performance, so the loop has been kept in the 
final version.

Final profiling of the attached patch compared to the original code 
resulted in an average value below 50%.

Still we could improve the number of calls with intelligent caching but 
that's another story.

Since this patch doesn't change the behaviour or breaks any backwards 
compatibility it should be applied to 4.5.x as well.

Cheers

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 17489_v6.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20110210/1a77ecd8/attachment.txt>


More information about the TYPO3-team-core mailing list