Problem/Motivation

On a complex form with multiple nested field groups, paragraphs, and other subforms, performance grinds to a halt with the TextFormat::addCallback() as it recursively takes a huge amount of memory. Xhprof output:

Steps to reproduce

Create a node edit form with eg 20 fields, use field group module, and use paragraphs module

Proposed resolution

Fix the addCallback recursion

Remaining tasks

Investigate

User interface changes

API changes

None

Data model changes

None

CommentFileSizeAuthor
2024-06-26_12-58.png133.01 KBscott_euser
2024-06-26_12-55.png294.81 KBscott_euser
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

scott_euser created an issue. See original summary.

scott_euser’s picture

Okay merge request created:

  1. NestedArray::getValue already checks key exists (or in fact keyExists method actually calls getValue so this reduces a lot of overhead by not doing the same thing twice given we are comparing many arrays with an array
  2. Drastically lower the depth to travel; the argument for it was for Gin, but Gin's depth is not 10 levels deep: https://git.drupalcode.org/project/gin/-/blob/8.x-3.x/src/GinContentForm...
scott_euser’s picture

Status: Active » Needs review
dolszewski’s picture

Status: Needs review » Reviewed & tested by the community

@scott_euser
Thank you for the MR. I checked it and it looks good!
We will include that change in the next release

scott_euser’s picture

Great thank you!

salmonek’s picture

Status: Reviewed & tested by the community » Fixed

@scott_euser We have released 1.3.0 with your patch. Thank you for the contribution.

scott_euser’s picture

Great thanks for taking care of it (and the other issues you released!). Much appreciated

Status: Fixed » Closed (fixed)

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