Problem/Motivation
When rendering complex sites, with a lot of components, especially with components that inherit each other over multiple levels, the rendering itself gets very slow. It seems it gets exponentially slower with each level of inheritance / embedding.
Steps to reproduce
Build 3 components that build on top of each other and render a lot of them. When we compare the render time of using the direct name of the component in the embed / include (so cl_components resolves the component and does its magic) it is painfully slow in comparison to loading the direct path of the twig file or the component via the components module (with "@modulename/path/to/twigfile").
Proposed resolution
Cache Plugin instances, because it seems that they get created on the fly for each call to a component and that creates a big performance hit.
Remaining tasks
Create issue fork / proposed resolution (Harlor has a POC we created together when we were debugging the performance of our project)
User interface changes
None
Issue fork cl_components-3333340
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
fisherman90Comment #4
fisherman90Comment #6
e0ipsoGreat find! This is superb feedback.
I was assuming that the plugin definitions were being cached, and therefore this should not be a problem. However, it seems that the code path for `find` ended up taking us elsewhere.
I'll do a code review on this soon.
Comment #7
e0ipsoComment #8
fisherman90Comment #9
e0ipsoI added some more feedback. I think I understand the intent better.
Comment #10
fisherman90Comment #11
e0ipsoThis looks good! Thanks for addressing the feedback. Merging and releasing.
Comment #13
fisherman90Thanks a lot for giving such qualitative and constructive feedback :D
Learned something new through it, very appreciated.
Also thanks to anyone else involved - pleasure working with you :)