Review main Merged

59083[TASK] Avoid slow array functions in loops

Andreas Kienast CR +2 V +2 Hard +254 −266 updated 09/25/19, 16:37

Commit message

This patch moves some array functions used in loops (array_merge,
array_replace) out of their calling loop for performance reasons, where
applicable.

This this achieved by calling the functions via array unpacking ("splat
operator").

See for further reading:
https://github.com/kalessil/phpinspectionsea/blob/master/docs/performance.md#slow-array-function-used-in-loop

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Frank Nägler +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Frank Nägler +1
    • TYPO3com +1 CI

Issues 1

Files 52

Show 32 more files

Review log 2031

Show 36 earlier messages
  1. Andreas Kienast uploaded patch set 1 12/11/18, 08:57

  2. TYPO3com voted on patch set 1 V -1 12/11/18, 09:07 Completed build in 10m 36s on Tue, 11 Dec, 10:07 AM Test Summary: 10 of 49144 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30582

  3. Andreas Kienast uploaded patch set 2 12/11/18, 09:14

  4. TYPO3com voted on patch set 2 V -1 12/11/18, 09:26 Completed build in 12m 47s on Tue, 11 Dec, 10:26 AM Test Summary: 4 of 49144 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30583

  5. Andreas Kienast uploaded patch set 3 12/11/18, 09:30

  6. TYPO3com voted on patch set 3 V +1 12/11/18, 09:41 Completed build in 11m 13s on Tue, 11 Dec, 10:41 AM Test Summary: 48732 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30584

  1. TYPO3com commented on patch set 2 12/11/18, 11:16 Completed build in 2h 14m 55s on Tue, 11 Dec, 12:16 PM Test Summary: 4 of 49144 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30583

  2. TYPO3com commented on patch set 1 12/11/18, 11:16 Completed build in 2h 29m 44s on Tue, 11 Dec, 12:16 PM Test Summary: 10 of 49144 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30582

  3. Andreas Kienast uploaded patch set 4 12/21/18, 14:59

  4. TYPO3com voted on patch set 4 V +1 12/21/18, 15:09 Completed build in 10m 11s on Fri, 21 Dec, 04:09 PM Test Summary: 48176 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-31035

  5. Andreas Kienast uploaded patch set 5 01/01/19, 18:17

  6. TYPO3com voted on patch set 5 V +1 01/01/19, 18:27 Completed build in 10m 37s on Tue, 1 Jan, 07:27 PM Test Summary: 47817 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-31181

  7. Andreas Kienast abandoned the change 01/23/19, 14:18

    Abandoned for now, might get picked up later.
  8. Andreas Kienast restored the change 08/05/19, 15:43

  9. Andreas Kienast uploaded patch set 6 08/05/19, 15:44

  10. TYPO3com voted on patch set 6 V -1 08/05/19, 15:55 Completed build in 11m 43s on Mon, 5 Aug, 03:55 PM Test Summary: 14 of 47531 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35601

  11. Andreas Kienast uploaded patch set 7 09/02/19, 08:31

  12. TYPO3com voted on patch set 7 V +1 09/02/19, 08:41 Completed build in 09m 35s on Mon, 2 Sep, 08:41 AM Test Summary: 47252 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35982

  13. Andreas Kienast uploaded patch set 8 09/02/19, 09:09

  14. TYPO3com voted on patch set 8 V +1 09/02/19, 09:19 Completed build in 10m 01s on Mon, 2 Sep, 09:19 AM Test Summary: 47252 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35984

  15. Andreas Kienast uploaded patch set 9 09/10/19, 07:43

  16. TYPO3com voted on patch set 9 V +1 09/10/19, 07:54 Completed build in 11m 13s on Tue, 10 Sep, 07:54 AM Test Summary: 47434 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36240

  17. Markus Klein commented on patch set 9 09/11/19, 09:35

    ExtensionManagementService.php:224

    are we sure that += behaves the same as array_merge?
  18. Andreas Kienast commented on patch set 9 09/11/19, 09:49

    ExtensionManagementService.php:224 Reply Unresolved

    It does not, but there's no other possibility to merge AND unpack an array.
  19. Frank Nägler voted on patch set 9 V +1 CR +1 09/25/19, 09:48

  20. Anja Leichsenring voted on patch set 9 V +2 CR +2 09/25/19, 09:59

  21. Anja Leichsenring merged patch set 10 09/25/19, 09:59

  22. Oliver Hader commented on patch set 10 09/25/19, 15:35

    I'm giving up the review of the whole patch... From my POV this has not improved readability and code quality - besides that, this patch is introducing lots of new regressions... -1 Please revert this change

    Clipboard.php:375 Unresolved

    lazy coding... (see below)

    Clipboard.php:448 Unresolved

    without the `$lines = [[]]` above either return empty array when it's empty (superfluous array_merge in that case) - or use `array_merge([],...$lines)` (still lazy coding)

    NewContentElementController.php:363 Unresolved

    ...

    TreeController.php:196 Unresolved

    ...

    AbstractItemProvider.php:755 Unresolved

    ...

    TcaTypesShowitem.php:186 Unresolved

    ...

    DocumentTemplate.php:609 Unresolved

    no benefit since it's in the same outer foreach loop... actually it got worse...

    AbstractTreeView.php:351 Unresolved

    ...

    FolderTreeView.php:269 Unresolved

    ...

    PageLayoutView.php:3767 Unresolved

    ...

    PageTreeView.php:272 Unresolved

    ...

    Bootstrap.php:543 Unresolved

    ...

    Bootstrap.php:563 Unresolved

    ... it's more complicated now ...

    ClassLoadingInformationGenerator.php:72 Unresolved

    ...

    DataHandler.php:7822 Unresolved

    ...

    DataHandler.php:7823 Unresolved

    ...

    DataMapProcessor.php:274 Unresolved

    ...

    SchemaMigrator.php:176 Unresolved

    ...

    Locales.php:204 Unresolved

    side-effect - having additional item + level now

    LocalizationFactory.php:120 Unresolved

    ...

    ResourceCompressor.php:145 Unresolved

    previous array_merge order seemed to be wrong - anyway: stylesheet is not on top

    ResourceCompressor.php:197 Unresolved

    side-effect - it's not on top anymore...

    UserFileMountService.php:124 Unresolved

    ...

    VariableProcessor.php:343 Unresolved

    ...

    TemplateService.php:1087 Unresolved

    ...

    ArrayUtility.php:480 Unresolved

    ...

    ClassMapGenerator.php:40 Unresolved

    ...

    RequestBuilder.php:312 Unresolved

    ...

    RequestBuilder.php:315 Unresolved

    ...

    PhpDocPropertyTypeExtractor.php:93 Unresolved

    ...

    LocalizationUtility.php:265 Unresolved

    ...

    ExtensionManagementService.php:183 Unresolved

    ...

    ExtensionManagementService.php:201 Unresolved

    side-effect - changed order of applying merge

    ExtensionManagementService.php:207 Unresolved

    side-effect - changed order of applying merge

    ExtensionManagementService.php:213 Unresolved

    side-effect - changed order of applying merge

    InstallUtility.php:385 Unresolved

    ...

    AbstractCompositeRenderable.php:140 Unresolved

    ...

    AbstractCompositeRenderable.php:142 Unresolved

    side-effect - wrong format now

    YamlSource.php:65 Unresolved

    ...

    TranslationService.php:628 Unresolved

    ...

    ContentObjectRenderer.php:5887 Unresolved

    ...

    ContentObjectRenderer.php:6047 Unresolved

    might have side-effect - order has changed

    AbstractTestCase.php:75 Unresolved

    ...

    AbstractTestCase.php:80 Unresolved

    might have side-effects - order has changed

    EnhancerLinkGeneratorTest.php:510 Unresolved

    ...

    EnhancerSiteRequestTest.php:496 Unresolved

    ...

    FeatureManager.php:75 Unresolved

    ...

    LocalConfigurationValueService.php:75 Unresolved

    ...

    LocalConfigurationValueService.php:140 Unresolved

    side-effect - different format

    DatabaseRecordList.php:3725 Unresolved

    ...

    DeletedRecords.php:528 Unresolved

    ..

    Status.php:90 Unresolved

    ...

    Status.php:97

    might have side-effect - order has changed

    Status.php:117 Unresolved

    might have side-effect - order has changed

    SchedulerModuleController.php:590 Unresolved

    ...
  23. Oliver Hader commented on patch set 10 09/25/19, 16:11

    Status.php:97 Reply

    Done
  24. Oliver Hader commented on patch set 10 09/25/19, 16:15

    ElementEntity.php:397 Unresolved

    might have side-effect - $this->nestedChildren not updated...

    GridDataService.php:168 Unresolved

    might have side-effect - $defaultGridColumns is not overriding table, id, uid anymore
  25. Anja Leichsenring wrote 09/25/19, 16:37

    Created a revert of this change as Ia31248587537a502ffdfc84761bacd7095999642