Problem/Motivation
\Drupal\geolocation\Element\GeolocationMap::getInfo has 3 callbacks, two as $class, one as $ths.
This causes it to store the current instance of the plugin object, including it's injected dependencies in the element info cache, which means it needs to load those classes and unserialize them on every request.
Steps to reproduce
Proposed resolution
use $class, do not use DI.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork geolocation-3616259
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
berdirIt's actually a pattern used by 4 element plugins.
It's not a huge issue, but it should also have the positive side effect of solving some annoying issues with how we generate a preload file, as the order of how these classes are loaded is somehow not stable.
Note: I tested/noticed this on 3.x, and the classes in 4.x are quite different, but the pattern is the same.
Comment #4
berdirWasn't sure if I should mark this as bug or task, it's not a functional bug, just a performance "bug".
Comment #6
christianadamski commentedInteresting, thanks!