[TYPO3-core] trimExplode

Bernhard Kraft kraftb at think-open.at
Sat Feb 9 15:47:30 CET 2013


Hello !

I have to announce that my new mission in the TYPO3 world will not to
write extensions for everthing but trying to improve the speed of TYPO3
in every thinkable manner (generating pages, caching mechanisms, etc.).

My first question is regarding the use of "trimExplode" in the core. I
did a little benchmark tests and profiling using xDebug and noticed that
"trimExplode" is used quite exhaustive.

So I started to look if it is required in every place. I have an
example. Not something very special. Just some occurence which explains
my idea:

class.t3lib_tcemain.php: function checkValue_text(...)

Here a t3lib_div::trimExplode is used. If you check the method which
gets called: checkValue_text_Eval then you will notice that by simply
changing:

- switch ($func) {
+ switch (trim($func)) {

The same can get achieved. I did a little benchmarking on the console
and noticed that doing a simple explode() and then trim() as necessary
is quite a bit faster than having a compound trimExplode().


If I haunt for such trimExplode() usages what would be the prefered way
of submitting patches: one by one trimExplode() --> explode() transition
per patch (commit in GIT) or a bunch of such, each concerning one core
class.



PS: My vote for Bugfixing days goes for Friday.


greetings,
Bernhard



More information about the TYPO3-team-core mailing list