[TYPO3-core] RFC Feature #16385: Optimize stdWrap usage for TypoScript content element PHP_SCRIPT

JoH asenau info at cybercraft.de
Mon Nov 15 14:00:10 CET 2010


>> Actually I am just "stdWrap-izing" any of the classes and methods
>> that are available in tslib/content (and class.tslib_content.php)
>> regardless of a possible deprecation.  
> 
> just a sidenote:
> You do realize stdWrap is the most expensive call in the whole
> frontend? 

Well - after the optimization of tslib_content it will get a lot cheaper ;-)

First of all, we improved the performance of stdWrap even though we extended all its function to be stdWrap aware themselves.
The chained if conditions have been replaced by real function calls out of a foreach loop based on existing keys.
This will "return early" when there is no stdWrap function in the set of available subkeys.

Second: Each call of stdWrap has been modified so that it won't be even touched, unless there is a key that indicates possible stdWrap functions.

The result for i.e. PHP_SCRIPT is:

10 = PHP_SCRIPT
10.file = blah
# no stdWrap call at all

10 = PHP_SCRIPT
10.file = blah
10.file.somekey = whatever
# 1 stdWrap call + early return
# since the is no stdWrap funcion "somekey"

10 = PHP_SCRIPT
10.file = blah
10.file.field = myField
10.stdWrap.wrap = /fileadmin/whatever/|
# 2 stdWrap calls + earlier return as with 4.4
# since both file.field and stdWrap.wrap
# do exist as functions but the rest of the functions
# doesn't have to be checked

Especially for setups that heavily use stdWrap this will give a performance boost.

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


More information about the TYPO3-team-core mailing list