#55564Improve GeneralUtility::revExplode performance
Description
GeneralUtility::revExplode always inverses the string and does multiple array operations, which are quite expensive. To speed it up, it can be split into several parts:
- a regular explode() for “0” parts [i.e. unlimited]
- just the string for 1 part
- manually split for 2 parts (saves the costly array operations)
- the old method for > 2 parts
A quick benchmark showed that 3 only takes half the time of 4 for the case of 2 parts (which currently is the only case in which this method is used in the core).
As this method is used extensively by e.g. GeneralUtility::dirname, this should give a performance increase of 1-2 ms in the backend.