Review main Merged

78784[TASK] Use less memory in BE::getPagesTSconfig()

Christian Kuhn CR +2 V +2 Easy +43 −5 updated 04/21/23, 12:36

Commit message

When BackendUtility::getPagesTSconfig() is called
with many different page uids, it can be a huge
memory hog: The pid-to-tsconfig contains a new
object for each pid.

However, page TSconfig is often the same for
different pages. The patch creates a two-level
cache for this.

The result can be stunning, for example with the
styleguide extension which creates a page tree
using DataHandler and then localizes records
on it using DataHandler. Measuring with the
extension from [1]:

Without patch:
* create tca data: ~148MB
* delete tca data: ~144MB

With patch:
* create tca data: ~12MB
* delete tca data: ~11MB

The patch also gives a performance benefit in
this use case.

[1] https://github.com/lolli42/peak_memory

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 79

  1. Christian Kuhn uploaded patch set 1 04/21/23, 11:43

  2. Oliver Klee commented on patch set 1 04/21/23, 11:46

    Looks very good! Just one nitpick.

    BackendUtility.php:741

    Nitpick: For both `!empty` checks, we don't need the `null` fallback, as `empty` also checks whether the array key exists.
  3. core-ci voted on patch set 1 V +1 04/21/23, 11:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41030

  4. Christian Kuhn uploaded patch set 2 V +1 04/21/23, 11:53

  5. Christian Kuhn commented on patch set 1 04/21/23, 11:53

    BackendUtility.php:741 Reply

    ah. true that. done.
  6. Oliver Klee voted on patch set 2 V +1 CR +1 04/21/23, 11:55

  7. core-ci voted on patch set 2 V +1 04/21/23, 12:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41031

  8. Stefan Bürk voted on patch set 2 V +2 CR +2 04/21/23, 12:36

  9. Stefan Bürk merged patch set 3 04/21/23, 12:36