Review main Merged

81917[TASK] Cache ordered providers in FormEngine

Christian Eßl CR +2 V +2 Hard +184 −320 updated 01/08/25, 07:37

Commit message

For large records with many "open" inline children, FormEngine
calculates the same OrderedProviderList over and over again.
This can turn into a bottleneck since DependencyOrderingService
is CPU hungry due to its graph algorithms.

The result of DependencyOrderingService within OrderedProviderList
is a function from given input arguments and can be easily
cached. The patch adds a runtime cache to OrderedProviderList, the
patch can be backported to v13 without side effects.

The patch also reveals some loose ends: It would be much better
to change FormDataGroupInterface to receive the 'providerList'
as argument to compile() which would render implementing services
stateless and shared. This would reduce the number of created
objects in this area to simplify and further improve performance.
It would be even better to turn the lists into service providers
which could be built and cached once at compile time.
This is out of scope of this patch and open for additional patches.

The change gives a measurable performance impact with records
having many "open" inline children: Editing a simple content
elmement with ten attached images reduces the number of expensive
calls to "orderByDependencies()" and saves about 5% server time at
the cost of slightly additional consumed of memmory.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 16

Review log 1724

  1. Christian Eßl uploaded patch set 1 11/23/23, 12:16

  2. core-ci voted on patch set 1 V -1 11/23/23, 12:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49664

  3. Christian Eßl uploaded patch set 2 V -1 11/23/23, 13:34

  4. Christian Kuhn commented on patch set 1 11/23/23, 13:36

    OrderedProviderList.php:104

    this should be safe since the identifier is created from 'all' input data? could we maybe switch to DI for the dependencies along the way?
  5. core-ci voted on patch set 2 V +1 11/23/23, 13:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/49688

  6. Christian Kuhn uploaded patch set 3 V +1 12/17/24, 16:54

  7. Christian Kuhn commented on patch set 3 12/17/24, 16:58

    hey. i think this patch is worth to get done: the calcutlated prodiver list is a straight side-free function from the input list, which is compile-time configuration. i think it does not harm to add a runtime-cache layer here. the current construct however suffers from 'setProviderList()' which makes everything stateful. i think we should have a first patch to deal with the performance issue, and then post-patches to get rid of 'setProviderList()' by changing compile() interface, *or* having a factory for the entire thing.
  8. Christian Kuhn commented on patch set 3 12/17/24, 17:00

    Reply

    for now, i pushed a rather straight change to use DI and to merge the cache identifier calculation into compile (which is quick), to suppress dependencyOrderingService calls on each call, but the tests will fail at the moment, and this needs a bit more detail changes to get done.
  9. core-ci voted on patch set 3 V -1 12/17/24, 17:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/71298

  10. Christian Kuhn commented on patch set 3 01/07/25, 15:51

    i measured this a bit with blackfire: setup is an image CE with 10 "opened" images. the change gives a measurable performance improvements - about 5% in this setup. i think we should finish the change.
  11. Christian Kuhn uploaded patch set 4 V -1 01/07/25, 16:47

  12. Christian Kuhn commented on patch set 4 01/07/25, 16:48

    OrderedProviderList.php:104 Reply

    Done
  13. Christian Kuhn commented on patch set 4 01/07/25, 16:53

    Reply

    Done
  14. core-ci voted on patch set 4 V -1 01/07/25, 16:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72053

  15. Christian Kuhn uploaded patch set 5 V -1 01/07/25, 16:56

  16. core-ci voted on patch set 5 V +1 01/07/25, 17:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72054

  17. Christian Kuhn updated the commit message in patch set 6 V +1 01/07/25, 17:17

  18. core-ci voted on patch set 6 V +1 01/07/25, 17:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72055

  19. Christian Kuhn updated the commit message in patch set 7 V +1 01/07/25, 17:25

  20. Christian Kuhn voted on patch set 7 CR +1 V +1 01/07/25, 17:25

  21. core-ci voted on patch set 7 V +1 01/07/25, 17:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72056

  22. Benni Mack voted on patch set 7 CR +1 V +1 01/08/25, 06:46

  23. Oli Bartsch voted on patch set 7 CR +2 V +2 01/08/25, 07:37

  24. Oli Bartsch merged patch set 8 01/08/25, 07:37