Review main Merged

96330[TASK] Reduce trimExplode processing and allocations

Wouter Wolters CR +2 V +2 Normal +48 −7 updated 10/21/26, 11:31

Commit message

Unlimited calls removing empty values filter the exploded array,
reindex it and then trim the retained values in a second pass. Calls
retaining empty values also split the entire string before folding the
tail or slicing to enforce a limit.

Trim and collect nonempty values in one loop for unlimited calls. Use
explode's native positive and negative limits when empty values are
retained, avoiding the full split and subsequent tail slicing and
joining.

Preserve limit handling when removing empty values. Empty values must
be filtered before folding the tail, whose internal whitespace must
remain intact.

PHP 8.5 benchmarks with OPCache enabled show 28-37% less runtime for
padded lists removing empty values. A 100,000-value mixed list uses 30%
less peak memory. Splitting 1,000 values with a limit of two is 36
times faster and uses 76% less peak memory. These are isolated method
measurements, not application-wide performance claims.

Add coverage for empty input, trim whitespace, zero and negative limits
exceeding the item count.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1722

  1. Wouter Wolters uploaded patch set 1 10/02/26, 18:28

  2. Wouter Wolters updated the commit message in patch set 2 10/09/26, 16:38

  3. Wouter Wolters rebased onto patch set 3 10/09/26, 16:39

  4. Wouter Wolters wrote 10/09/26, 16:39

    Unset private
  5. Wouter Wolters marked it ready for review 10/09/26, 16:39

  6. core-ci voted on patch set 3 V -1 10/09/26, 17:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110649

  7. Wouter Wolters uploaded patch set 4 V -1 10/19/26, 21:00

  8. Wouter Wolters commented on patch set 4 10/19/26, 21:01

    GeneralUtilityTest.php:861 Unresolved

    PHP 8.6 adds form feed ("\x0C" / "\f") to the characters trimmed by default. This is an intentional PHP change (https://wiki.php.net/rfc/trim_form_feed).
  9. core-ci voted on patch set 4 V +1 10/19/26, 21:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111725

  10. Markus Klein commented on patch set 4 10/20/26, 15:31

    GeneralUtility.php:822

    we can still move this to the first line and use $result in line 808 and 811
  11. Wouter Wolters uploaded patch set 5 V +1 10/20/26, 16:41

  12. Wouter Wolters commented on patch set 5 10/20/26, 16:42

    GeneralUtility.php:822 Reply

    Done
  13. Oliver Klee voted on patch set 5 CR +1 V +1 10/20/26, 16:47

  14. core-ci voted on patch set 5 V +1 10/20/26, 16:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111893

  15. Oli Bartsch uploaded patch set 6 CR +1 V +1 10/21/26, 10:42

  16. Oli Bartsch updated the commit message in patch set 7 10/21/26, 10:43

  17. Oli Bartsch voted on patch set 7 CR +1 V +1 10/21/26, 10:44

  18. core-ci voted on patch set 6 V +1 10/21/26, 10:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111997

  19. core-ci voted on patch set 7 V +1 10/21/26, 11:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111998

  20. Oliver Klee voted on patch set 7 CR +1 V +1 10/21/26, 11:23

  21. Oli Bartsch voted on patch set 7 CR +2 V +2 10/21/26, 11:31

  22. Oli Bartsch merged patch set 8 10/21/26, 11:31