Review main Merged

77484[TASK] Reduce SQL queries in AbstractMenuContentObject::isSubMenu()

Christoph Lehmann CR +2 V +2 Normal +85 −28 updated 01/20/23, 11:06

Commit message

The method now pre-fetches and caches subpages for all pages on
the same level in order to reduce the amount of database queries.

Have a menu with 50 subpages
- WITHOUT this: 50 SQL queries
- WITH this: 1 SQL query

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Christian Kuhn +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1924

  1. Christoph Lehmann uploaded patch set 1 01/18/23, 20:51

  2. core-ci voted on patch set 1 V -1 01/18/23, 21:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36150

  3. Oliver Hader commented on patch set 1 01/18/23, 22:06

    AbstractMenuContentObject.php:1407

    use `static fn (array $item) => (int)$item['pid'] === (int)$uid` as callback (arrow function allows to omit the `use` scoping)
  4. Stefan Bürk commented on patch set 1 01/18/23, 22:29

    AbstractMenuContentObject.php:1403

    Can't we reuse the already available "runtime" cache instead of introducing a "instance" property as cache here ? Maybe some thoughts about proper identifier must be put in, but guess that's cleaner. What do you think ?
  5. Christoph Lehmann commented on patch set 1 01/18/23, 23:16

    AbstractMenuContentObject.php:1403 Reply

    Good idea. Currently there is one issue left, so that tests fail. I think the isSubMenuCache needs the "current" pid. Will check tomorrow.
  6. Christoph Lehmann commented on patch set 1 01/18/23, 23:18

    AbstractMenuContentObject.php:1403 Reply

    (in the cache identifier)
  7. Christoph Lehmann uploaded patch set 2 V -1 01/19/23, 09:49

  8. core-ci voted on patch set 2 V -1 01/19/23, 09:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36178

  9. Christoph Lehmann commented on patch set 2 01/19/23, 10:45

    AbstractMenuContentObject.php:1407 Reply

    Done
  10. Christoph Lehmann commented on patch set 2 01/19/23, 10:46

    AbstractMenuContentObject.php:1403 Reply

    Done
  11. Christoph Lehmann uploaded patch set 3 V -1 01/19/23, 10:59

  12. Christoph Lehmann commented on patch set 3 01/19/23, 11:01

    Added list of page ids to cache identifier, because a second subpage menu of the same site may has a different records in $this->menuArr
  13. Stefan Bürk commented on patch set 3 01/19/23, 11:16

    AbstractMenuContentObject.php:184

    This is now superflous and can be removed.
  14. core-ci voted on patch set 3 V -1 01/19/23, 11:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36195

  15. Oliver Klee commented on patch set 3 01/19/23, 11:37

    AbstractMenuContentObject.php:1407

    Please let's make the check explicit instead of relying on an implicit bool cast: if (!is_array($cachePagesNextLevel)) {
  16. Christoph Lehmann uploaded patch set 4 V -1 01/20/23, 09:23

  17. Christian Kuhn commented on patch set 4 01/20/23, 09:27

    AbstractMenuContentObject.php:1407 Reply

    Done
  18. core-ci voted on patch set 4 V -1 01/20/23, 09:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36308

  19. Christian Kuhn uploaded patch set 5 V -1 01/20/23, 10:03

  20. Christian Kuhn commented on patch set 5 01/20/23, 10:04

    Removed v11 *for now*: I think it's good to have this in main for a while and wait a bit. If this works out, it may be ok to backport to v11.

    AbstractMenuContentObject.php:184 Reply

    Done
  21. core-ci voted on patch set 5 V +1 01/20/23, 10:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36315

  22. Christian Kuhn voted on patch set 5 V +1 CR +1 01/20/23, 10:38

  23. Anja Leichsenring voted on patch set 5 V +2 CR +2 01/20/23, 11:05

  24. Anja Leichsenring merged patch set 6 01/20/23, 11:06