Drupal\project_browser\Element\ProjectBrowser::getDrupalSettings() is uncached

Created on 7 January 2025, 13 days ago

Problem/Motivation

Drupal\project_browser\Element\ProjectBrowser::getDrupalSettings() on a Drupal CMS install (just the starter kit), takes about 16 seconds and several megabytes of memory. See xhprof screenshot below.

This happens every time you refresh the page.

Steps to reproduce

Install Drupal CMS in ddev, enable xhprof, browse to https://drupal-cms-dev.ddev.site/admin/modules/browse/recipes.

Proposed resolution

This is all from:

     $package_manager = array_merge($package_manager, $this->installReadiness->validatePackageManager());

It must be possible to cache this, if installing or updating a module invalidates it, that might be enough?

But also given it's so expensive to generate, it would be better if it could be calculated outside the critical path. Since it's used in Drupal settings and only required on project browser pages, could it moved to an AJAX request and then populate drupal settings from there? Although it would still need the caching too.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024