Try to reduce database queries from MenuLinkTree::load()

Created on 11 December 2024, 8 days ago

Problem/Motivation

Found via Drupal CMS performance testing 📌 Add performance testing Active .

I manually tested this with the standard profile + navigation instead of toolbar. Toolbar does some very specific custom menu tree caching using local storage, navigation currently uses fairly standard menu tree rendering. However this isn't specific to navigation, it's inherent in core's menu API and the system admin menu block access checks.

Steps to reproduce

Proposed resolution

Two options, one builds on the other:

1. For some reason the tree for system.admin_config_media gets loaded three times in succession, if we add a static cache, it would be once. There might be other duplicates, not sure yet.

2. The individual admin block menu trees with depth 1 and a specific parent are loaded after the full tree to depth 4 for the admin menu is loaded. If that menu includes those pages and one depth of children (or if we increased the depth by 1), could we traverse already-loaded trees in MenuLinkTree::load(), see if an item is already there, and return from the static cache? If so we could save 10 or so database queries here.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

menu system

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