[TASK] Improve revExplode performance 55/27255/5
authorAndreas Wolf <andreas.wolf@typo3.org>
Sat, 1 Feb 2014 18:50:18 +0000 (19:50 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 9 Feb 2014 14:05:05 +0000 (15:05 +0100)
commit7da40c0b10057128c9c5e691cd155c7f255d537e
tree787d93443fd77573c4817ff04d22362ff39ffde8
parent3127efc26bba99116600a06dea77ece31ab8ffad
[TASK] Improve revExplode performance

``GeneralUtility::revExplode()`` is implemented in a very
performance-intensive way: it always does a complete cycle with multiple
array operations, be it necessary or not.

To make the method more performant, it is split into different cases.
Currently, the only used value for the ``$count`` in the core is 2, but
we have to implement all others, too, of course. The performance
increase for $count=2 is greater than 50%; the others will at maximum be
as bad as the old implementation, plus a very tiny overhead for checking
the value of ``$count``.

Change-Id: I79d9a87b790935415c636ee87e6a6db952e0baa4
Resolves: #55564
Releases: 6.2
Reviewed-on: https://review.typo3.org/27255
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php