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

Command icon 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

fisherman90 created an issue. See original summary.

Harlor made their first commit to this issue’s fork.

fisherman90’s picture

Issue summary: View changes
fisherman90’s picture

Issue summary: View changes

e0ipso’s picture

Great 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.

e0ipso’s picture

Status: Active » Needs work
fisherman90’s picture

Status: Needs work » Needs review
e0ipso’s picture

Status: Needs review » Needs work

I added some more feedback. I think I understand the intent better.

fisherman90’s picture

Status: Needs work » Needs review
e0ipso’s picture

Version: 1.0.0-rc5 » 1.x-dev
Category: Feature request » Task
Status: Needs review » Fixed

This looks good! Thanks for addressing the feedback. Merging and releasing.

  • e0ipso committed 1ec1bb0c on 1.x authored by Harlor
    Issue #3333340 by Harlor, fisherman90, e0ipso: Cache plugin instances...
fisherman90’s picture

Status: Fixed » Closed (fixed)

Thanks 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 :)