Problem/Motivation

ParagraphsBehaviorCollection::getEnabled instantiates every defined behavior, just to get the enabled ones.

Inclusive Wall Time: 715,543 µs => 93,134 µs

Before

After

This is on a site with layout_paragraphs enabled. The node has 240 paragraphs, hence the high call count.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork paragraphs-3604178

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

webflo created an issue. See original summary.

webflo’s picture

Issue summary: View changes

berdir’s picture

Status: Active » Needs review

Just saw this pop up as well, if not with that many calls. That's a lot of paragraphs?

I think what should also help here is enable static caching on paragraph types, then we have fewer instances of them and they can share the plugin instances. But I'll need to fix tests first to ensure nothing breaks with that.

  • berdir committed 085ff10f on 8.x-1.x authored by webflo
    perf: #3604178 Optimize ParagraphsBehaviorCollection::getEnabled
    
    By:...
berdir’s picture

Status: Needs review » Fixed

Merged. You might want to test the impact of #3608381: Enable static caching on paragraph types as well.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.