Performance with getRouteCollection / XDebug

Created on 27 February 2024, 9 months ago
Updated 13 March 2024, 8 months ago

Problem/Motivation

Usage of getRouteCollection makes the hook gin_everywhere_gin_content_form_routes_alter slow. I recognized this locally with XDebug enabled in my php.ini, but i don't think XDebug is the cause of the problem. The more content / media types i install, the slower the hook becomes.

The comment on Symfony\Component\Routing\RouterInterface (link for 6.4 with drupal 10.2) for the function getRouteCollection():

WARNING: This method should never be used at runtime as it is SLOW.

Steps to reproduce

  1. install recommended project composer create-project drupal/recommended-project name and run install.
  2. use gin, gin_toolbar composer require drupal/gin_toolbar:^1.0@rc drupal/gin:^3.0@rc and active gin and gin_toolbar
  3. use gin_everywhere composer require 'drupal/gin_everywhere:^1.0' and active it
  4. install xdebug and enable it in php.ini - dont run a debug-session
  5. browse to /user/1/edit and the website loads very slow

Proposed resolution

Dont use getRouteCollection.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany harkonn

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