Problem/Motivation

Some people reported that the UI gets slow with lots of Paragraphs.

Proposed resolution

We need to investigate the situation and at least start to track it with a reference setup.
We should also figure out with profiling if we can skip major parts of the load.

Remaining tasks

Define reference case(s)
Profile
Improve

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miro_dietiker created an issue. See original summary.

miro_dietiker’s picture

Let's have three reference cases. Each case NOT randomised, but with a fixed sequence.

1) 1 type with a text field and a total of 100 paragraphs added flat to the node. Text should be filled with repeating text so that there is actual content and not emptyness.
1.1) Default Mode Edit
1.2) Default Mode Closed

2) 3 types (text, images, account reference) with 100 paragraphs added flat.
2.1) Default Mode Edit
2.2) Default Mode Closed

3) Deep nested setup with text only as leaves. 10 top level containers, each with 3 levels of childrens with each 2 text paragraphs as leave. That's 10*2^3 = 80 leaves plus the nodes.
3.1) Default Mode Edit
3.2) Default Mode Closed

We need to implement these cases with preparation time separated, widget loading time separated, with a clearly defined state of the entity cache. I guess also measured once with cold caches.

And then, i would want to compare the performance also with an old version of Paragraphs to learn how much / if we degraded performance.

miro_dietiker’s picture

Ah, this means primarily adding this stuff through the ui, not the api, because we want to know how slow the ui is.

We might want to implement a pure api measure too, to understand how much overhead the ui adds, but that's less priority.

And yeah those are no tests. This should NOT be rerun on every testbot trigger, just from time to time intentionally.

miro_dietiker’s picture

Discussed with Berdir.

Let's create the mass of entities with API.
And only measure edit and adding 1 more somewhere.

Let's do this as separate project (sandbox) and use a BrowserTest.
The Test will write profiling data into a file for later display.

toncic’s picture

Assigned: Unassigned » toncic

I will try this one.

miro_dietiker’s picture

Possible follow-up: Our profiling should also include viewing a node. This needs spec in more detail.

toncic’s picture

Status: Active » Needs review
FileSize
6.28 KB

Create three different cases:
1) 1 type with a text field and a total of 100 paragraphs added flat to the node.
2) 3 types (text, images, account reference) with 100 paragraphs added flat.
3) Deep nested setup with text only as leaves.

Also created start function which recording time and connect with some markup.

toncic’s picture

Issue summary: View changes
FileSize
45.61 KB

Providing screenshot.
We need to discuss how we want to display these value, for now I am using basic debug function.

miro_dietiker’s picture

Most importantly, display them as deltas.

toncic’s picture

For now it is looking like this for nested paragraphs case:

toncic’s picture

Step further, added content for case with nested paragraphs and changed displaying test result.
I figured out that we have problem with action buttons with huge number of paragraphs.

toncic’s picture

Added part for testing changing edit mode.
Take three screenshots for nested paragraphs case to see if spent time is similar every time when we run the test.
After that uploaded patch from #2673076: Investigate loading pattern of field_collection and again take three screenshots.
The creating time is double faster and now action buttons are working but very slowly.
Still need to fix some small stuff about displaying results.

miro_dietiker’s picture

Great progress! Finally we have a reference so we can measure effective speed and improvements (or worsening). No more "it is sooo slow" myths, but data.

Didn't yet review the patch, but we should document some aspects of the performance measure, so people understand how much ui and api performance can be expected with Paragraphs.

toncic’s picture

Small changes with markers, to make report more readable.

toncic’s picture

miro_dietiker’s picture

I think best is if we create a sandbox and add the module there. This is for local execution only i guess.
But let's wait for more opinions, i'll create after consent.
Results though (and how to test them) should be provided and documented in Paragraphs itself.

toncic’s picture

@Berdir is also agree with creating new project and move this module there.

miro_dietiker’s picture

Project: Paragraphs » Paragraphs Performance

Please update the issue to make it apply in this project. We will keep it as a sandbox.

  • toncic committed 7341d88 on 8.x-1.x
    Issue #2847110 by toncic: Profile UI performance
    
toncic’s picture

Version: 8.x-1.x-dev »

Committed this just to initialize project. Still need review and discussion.