Issue Bug Needs Feedback Stale

#109180Editing a record in TYPO3 v14.2.0-dev takes much longer than in TYPO3 v13 LTS

Xavier Perseguers 03/06/26, 13:45 updated 07/15/26, 07:41

Description

(context for me: cpal.ch, opening concert program 2020 – Mendelssohn en intimité, this is a custom extension, own TCA with multiple IRRE)

Website in v14-dev, PHP 8.3.30

(current dev state)

1. DDEV xdebug off
2. Dev console / Network empty
3. Content > Records > Click on pencil to edit
4. Call to edit?token=… took 15.60 seconds

Same website in v13.4.26

(switch back project to branch for v13, composer update, resync all files and DB from production)

1. DDEV xdebug off
2. Dev console / Network empty
3. Web > List > Click on pencil to edit
4. Call to edit?token=… took 464 ms

Switching back to v14.2.0-dev

1. DDEV xdebug off
2. Install Tool to perform all suggested migrations (DB), my extensions are compatible with both v13 and v14, same source code
3. Web > List > Click on pencil to edit
4. Call to edit?token=… took 16.11 s
5. Close and again
6. Call to edit?token=… took 15.82 s

Bottom-line

Open to analysing anything, just tell me.

Reviews 1

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". The changes above were merged or abandoned: read them before you start. How to create a patch

Commit message
[BUGFIX] Editing a record in TYPO3 v14.2.0-dev takes much longer than in TYPO3 v13 LTS Resolves: #109180 Releases: main

Files 4

History 11

  1. Xavier Perseguers commented <span data-processor="relativetime" data-value="2026-03-06T14:19:46+00:00" > 03/06/26, 14:19 </span>

    - 37k calls to BackendUtility::getRecordTitle
    - 24k calls to GeneralUtility::callUserFunction
    - 12k calls to a custom function of my model Causal\Concerts\Backend\Tca\PerformanceRole->getLabel (used for the TCA)
    - 36k calls to BackendUtility::getRecord
    - and thus as much as queries to the DB

    That doesn’t look sane :)

  2. Xavier Perseguers commented <span data-processor="relativetime" data-value="2026-03-06T14:42:20+00:00" > 03/06/26, 14:42 </span>

    - Introducing a custom dumb static cache for one of my TCA’s label computation: down to 10.96 sec.
    - Introducing another cache for another TCA’s label computation: down to 960 ms

    That’s still slower but much better. Strange that somehow TYPO3 changed and is now calling the same label over and over again…

    Just for the record: testing this caching in TYPO3 v13 results into 409-410 ms, so slightly better but not significantly, something dramatically broke in TYPO3 v14.

  3. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2026-03-06T16:49:36+00:00" > 03/06/26, 16:49 </span>

    Hey Xavier,

    thanks for the report. is the amount of numbers same in v14 and v13?

    https://forge.typo3.org/issues/109180#note-2

  4. Xavier Perseguers commented <span data-processor="relativetime" data-value="2026-03-06T17:14:25+00:00" > 03/06/26, 17:14 </span>

    Hey Benni. Did not create a profiler trace in v13 since there was no problem. But obviously the numbers are not the same, no. Proof is that what my dumb cache does it basically this in the label computation:

        public function getLabel(array &$params): void
        {
            static $labelCache = [];
    
            ...
    
            $cacheKey = $params['row']['musicalwork'] . '-' . $role;
            if (isset($labelCache[$cacheKey])) {
                $params['title'] = $labelCache[$cacheKey];
                return;
            }
    
            // complete computation, with calls to BackendUtility::getRecord and BackendUtility::getRecordTitle
            // for related records (multiple IRRE / dynamic values with performers, roles, ...)
        }

    Without that, the “same labels” are obviously computed an astronomic number of times in v14, in v13, adding that cache does not change much, so obviously TYPO3 v13 has no problem but v14 introduced some crazy useless calls to compute the same labels over and over again.

    We can discuss privately if you want a copy of my extension and a dump of the database. The corresponding record I’m editing has a few IRRE relations but not much, so really nothing crazy.

  5. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-06T18:48:14+00:00" > 03/06/26, 18:48 </span>

    How many IRRE child records are contained inside the record you are editing?

  6. Xavier Perseguers commented and changed attached program.png attached performancerole.png attached role.png attached roles.png <span data-processor="relativetime" data-value="2026-03-07T09:04:21+00:00" > 03/07/26, 09:04 </span>

    Editing a “program”

    program.png

    2 IRRE for the 2 associated concerts

    Opening a “concert”

    That the big more complex part.

    performancerole.png

    You need first to understand how it works:

    1. A program will have references to the various musical works that will be presented
    2. A musical work has a list of so-called “roles”:
    ** Role “Orchester” for the orchester
    ** Role “Bass” for the bass solist
    ** Role “Soprano” for the soprano solist
    ** but also: role “Jesus” for a bass voice
    ** Role “Evangelist” for a tenor voice

    3. A concert assigns a performer (director, orchester, solists, …) to the various roles, this is the performance roles we see in screenshot above. In most musical works you have for instance “mix choir+solist soprano”, that’s two roles for the voices, but in St-Matthieu Passion from Bach, you have an Evangelist, Jesus, and so on, so named roles, just as you have in musical [comedy] as the Phantom of the Opera. I wanted to be able to know who sung the “Evangelist” of that or that musical work rather than just know that some random tenor was there.

    Performance role

    role.png

    The list of available “roles” is dynamically generated based on the selected musical works associated to the program (thus the top-most container record we started to edit):

    roles.png

    In that, not so many roles as there is only a single musical work, but the list may be a bit larger, with basically usually at least 3-4 roles per musical works (choir, direction and either piano/orchester, and often at least 1 solist voice).

    And below we have a list of all potential performers to be associated to the role (around 300 at time of writing). I wanted once to filter the list based on the associated “type of performer expected” for a given role (e.g., when you look for a soprano voice, no need to show bass performers or orchesters), but it proved to be way too complicated and not so UX-friendly anymore due to the fact that TYPO3 force reloads the form in such cases. And I didn’t want to fiddle with custom dynamic AJAX requests.

    So all in all, as you see, there are not actually so many relations in the final record, absolutely nothing fancy I’d say, but somehow in TYPO3 v14 something has changed that results into generating 36k calls to the DB and 37k calls to prepare a record title. And I’m not speaking in total when you start opening each IRRE, but really just to show the edit form of the top-most program container record.

    And I know that some of those calls are “my fault” because I use a user function to generate the record’s title in TCA, and that call may perform a few calls in turn, but that doesn’t explain the crazy number of calls for the top container, nor any IRRE record when editing. And the proof that the same label is asked tons of times is that I added as a counter-measure, as written earlier in note 3 a simple static memory cache for user label so that generating the same label another time reused the existing computation, leading to a total of 960 ms down from 15 seconds to show the edit form. Counter-measure, but not something I should care, and I never cared in TYPO3 11, 12, 13 (actually I just checked, and this project started back with TYPO3 4.5 :D)

  7. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-09T11:24:15+00:00" > 03/09/26, 11:24 </span>

    I want to leave my notes for the investigations I did earlier today and wrote to Xavier via DM:

    I investigated your implementation, thanks for sharing.

    I did find out that https://review.typo3.org/c/Packages/TYPO3.CMS/+/90190 caused this. The user label func is called “recursively” (only two levels though) for every record type when populating references.
    That happens sadly because this god static utility class is called from very different contexts, and wants to ensure that label user funcs are executed, even when called from within a userfunc.

    I’m not sure we can solve this in Core itself. Your solution of introducing a runtime cache is thus really the best way here (IMO).

    So in your case the problem is that getRecord() is called within the label userFunc there, and this causes the DB lookups, which are now performed much more often due to the “label enforcement” of Schema API.

    We cannot easily introduce a runtime/static cache within getRecord, because the consumers of that method may changed intermediate data, and flushing caches is hard. So it could lead to breakage when we suddenly cache records that have been changed. This is why the outside consumers of getRecord will need to ensure caching opportunities.

    I’m not sure yet how/if we could document this case of Core development other than a generic hint like “If you implement label_userfunc, be sure to cache away any DB results, becaues this method is getting hit VERY OFTEN”.

    In the future maybe we can replace getRecord with better Record API implementations that can carry caching state, and prevent DB access by having the cached representation within the record object itself.

    Maybe this note here can help others as well.