73189[TASK] Avoid reading languagefiles if argument is empty
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Oliver Klee +1
- Robert Kärner +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Robert Kärner +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1214
-
Stefan Bürk uploaded patch set 1 01/28/22, 11:57
-
core-ci voted on patch set 1 V +1 01/28/22, 12:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22617
-
Oliver Klee voted on patch set 1 CR +1 01/28/22, 12:18
-
Robert Kärner voted on patch set 1 V +1 CR +1 01/28/22, 12:20
-
Benjamin Franzke commented on patch set 1 CR -1 01/28/22, 12:36
I'm not sure it's worth the overhead to trim every input only to check for an empty string. Do you have an example where this method is actually called with an empty string or even a string with whitespace only? I'd say a performance "optimization" like this should be fast and therefore avoid trim. -
Stefan Bürk commented on patch set 1 01/28/22, 12:41
Reply
For empty see https://review.typo3.org/c/Packages/TYPO3.CMS/+/73176 trim() was for catch eventually " " or " " to .. but no real use case. Will remove it (until this case would be a known/occured use case) -
Stefan Bürk uploaded patch set 2 01/28/22, 12:42
-
core-ci voted on patch set 2 V +1 01/28/22, 12:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22622
-
Stefan Bürk commented on patch set 2 01/28/22, 12:52
Reply
Anyway, trim() is done anyway in https://review.typo3.org/c/Packages/TYPO3.CMS/+/73189/2/typo3/sysext/core/Classes/Localization/LanguageService.php#177 so it would be more a move a little above. eventually we should add the trim to the string-cast already, to have trim() only once invoked in the sl() method. Besides this it would use the same runtime cache if there should be occurances with "LLL:" and " LLL:" or like that. And it's not only core, we should take into account that this method is used by others too, not only the core. So should we move the trim up to the string cast, and remove it from both checks ? (or now from current only one check) -
Stefan Bürk commented on patch set 2 01/28/22, 12:54
Reply
Eh .. forget it. Would be change in behaviour for constant labels which may contain leading or tailing spaces. -
Robert Kärner voted on patch set 2 V +1 CR +1 01/28/22, 12:59
-
Oliver Klee voted on patch set 2 CR +1 01/28/22, 13:01
-
Benjamin Franzke voted on patch set 2 V +2 CR +2 01/28/22, 13:10
-
Benjamin Franzke merged patch set 3 01/28/22, 13:10