Improve the performance of \Drupal\Core\Update\UpdateRegistry::getRemovedPostUpdates()

Created on 12 January 2024, 11 months ago
Updated 19 February 2024, 10 months ago

Problem/Motivation

I'm investigating a site install profile that takes over 4 minutes to install. As a part of that, I noticed that nearly 20% of the installation time was in calls to \Drupal\Core\Update\UpdateRegistry::getRemovedPostUpdates() and its child functions.

This MR adds in a static memory cache so that each module is only ever scanned once per bootstrap.

Here's a diff of a custom profile from before this change and after.

And for something more reproducible, here's demo_umami with a 2% improvement:

.

Steps to reproduce

I think this is best tested on sites with many, many modules and configuration exports. In this case, the site has ~350 modules and ~2800 config objects. Looking at the test runs, it doesn't appear this improves the standard or testing profiles at all, but perhaps it shows up with umami.

Proposed resolution

Add a static cache.

Remaining tasks

Confirm this isn't a bc break for backporting to Drupal 10.

User interface changes

None

API changes

None, constructor changes only.

Data model changes

None

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.2 ✨

Component
InstallΒ  β†’

Last updated 7 days ago

No maintainer
Created by

πŸ‡¨πŸ‡¦Canada deviantintegral

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024