77801[TASK] Simplify a condition in GU::intExplode
Commit message
Review
-
Code review CR +2 Done
- Nikita Hovratov +2
- Christian Kuhn +1
- Jörg Bösche +1
-
Verified V +2 Done
- Nikita Hovratov +2
- Christian Kuhn +1
- Jörg Bösche +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1112
-
Oliver Klee uploaded patch set 1 02/09/23, 12:51
-
Mathias Brodala commented on patch set 1 02/09/23, 12:54
I'd assume that this was done for performance reasons since an unnecessary trim() call can be avoided for a completely empty string. Not sure if it really matters in the end. -
core-ci voted on patch set 1 V +1 02/09/23, 13:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37449
-
Oliver Klee commented on patch set 1 02/09/23, 13:09
Reply
Yes, that would sense as a potential micro-optimization. In that case, I'd prefer the simpler version of the code (until we know that this is a performance bottleneck). -
Stefan Bürk commented on patch set 1 02/09/23, 20:47
Reply
It's in a foreach loop. This method is used, not rarely for id lists. So I would not trade that here - in fact, as the current condition is not that complex and rather simple, sry. -
Oliver Klee commented on patch set 1 02/09/23, 21:46
Some performance numbers on my machine using PHP 8.1 using a string of 10 million commas (excluding the time required for autoloading): - with my change: .57-.59s - without my change: .50-.54s -
Christian Kuhn commented on patch set 1 02/09/23, 22:37
Reply
so keep current solution? -
Oliver Klee commented on patch set 1 02/09/23, 22:48
Reply
I've though about it some more and ran some more numbers, now also with the case "10 million single-digit numbers without empty entries" (thinking that the case "no or only a few empty cases" should be more common). In that case, the modified version actually is faster: Original code with 10 million empty strings: 0.52295303344727s Modified version with 10 million empty strings: 0.58760499954224s Original code with 10 million numbers: 0.8268039226532s Modified version with 10 million numbers: 0.65030598640442s So I'd suggest having this change. -
Christian Kuhn voted on patch set 1 V +1 CR +1 02/14/23, 11:06
-
Jörg Bösche voted on patch set 1 V +1 CR +1 02/17/23, 11:44
-
Nikita Hovratov voted on patch set 1 V +2 CR +2 02/17/23, 19:24
-
Nikita Hovratov merged patch set 2 02/17/23, 19:24