Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
Part of our performance issues in Drupal 8 are the sheer number of classes that need to be loaded.
I profiled an internal page cache hit, and saw some interfaces which couldn't possibly be needed being loaded. Turns out this is due to #1973618: DIC: Lazy instantiation of service dependencies (ProxyManager for "proxy services").
In the compiled container, we generate a proxy class that implements the interface for the real service.
On page cache hits, this means something like 10-15 interfaces being loaded. This is out of 73 total.
See attached file. For example ConfigInstallerInterface
Proposed resolution
- Dump the lazy services into their own files
- Register a PSR-4 namespaces for that dumped lazy files
- Measure whether its worth to do it
Comments
Comment #1
catchComment #2
catchComment #3
dawehnerUpdated the IS based upon our IRC discussion
Comment #4
catchChanging the parent issue. While this is the case on every request, the overhead is most noticeable on internal page cache hits.
Comment #5
Fabianx CreditAttribution: Fabianx as a volunteer commentedAgree with proposed resolution, lets also not do that at run-time (proxy services are entirely optional optimization), but at commit and compile time.
Comment #6
dawehnerNote: #2408371: Proxies of module interfaces don't work would solve that problem
Comment #7
catchYep. Marking this postponed on that, then we can close as duplicate.
Comment #8
catch#2408371: Proxies of module interfaces don't work
Comment #9
catch