-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: Improve render performance (scrolling and typing) #23568
Conversation
Size Change: +846 B (0%) Total Size: 1.14 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this 💯 Thanks a lot, this is very cool.
@@ -266,6 +266,7 @@ function Layout() { | |||
<KeyboardShortcutHelpModal /> | |||
<WelcomeGuide /> | |||
<Popover.Slot /> | |||
<Popover.Slot name="block-toolbar" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this slot was not rendered her for a valid reason. Otherwise, it just duplicated the slot that is above it. cc @ellatrix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@youknowriad Hmm! Interesting.. I wasn't aware of that !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be rendered in the content scroll container, because when you scroll while the pointer is over the toolbar, the content still needs to scroll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have commented here 😅
There might be other reasons I'm forgetting.
Instead of the clever, but somewhat hacky method of using |
@ZebulanStanphill Oh interesting! I didn't know about |
Hmm.. Not sure how to debug the failing E2E tests. |
Hey @ItsJonQ -- great additions here!
Have you tried commenting I'll take a look now on your branch to see if I can help :) |
@ntsekouras Thanks for helping! I'm not too sure how to resolve this. The test passes for me (locally) in interactive mode.
(I run it with
|
What are the performance results compared to |
@ellatrix Excellent question! I just ran some Performance + FPS tests against master. TypingI think typing is where we'd see/feel noticeable improvements. In the following performance tests, I typed "Typing into the editor" into a Paragraph block. BeforeAfter(Higher overall FPS levels) The performance tool makes things laggier (in general). However, it felt smoother typing with the new render improvements. ScrollingNot a huge change. But a bit! BeforeAfterLooks like lower CPU spikes during start/stops. Scrolling FPS🚨 Warning: Fast GIFs incoming... Before(Up to approx. 50-51FPS on heavy scrolling) After(Up to approx. 54-55FPS on heavy scrolling) |
Updates. After a bunch of poking and testing... it looks like the E2E tests aren't happy with the
Maybe it's something up with Puppeteer? Maybe not. Unfortunately, that is important piece for this performance enhancement, which attempts to tame repaint/layout calc. Maybe we should give up on this for now? |
I think it's still worth trying out as a progressive enhancement for the browsers that do support it, regardless of whether we also proceed with this PR or not. |
@ZebulanStanphill That's fair. What's strange is... I experimented with |
Closing this for now. The initial research was helpful in identifying the problem areas. |
This update improves the rendering performance of the editor, especially for user interactions such as typing and scrolling.
This was achieved using a combination of CSS and JS updates that leverage GPU rendering where appropriate and optimize layout calculations.
Here are the results:
(Recorded on Chrome with the paint rendering debug tool enabled).
A green flash indicates a browser repaint.
Before
https://d.pr/v/g3eX8A
Notice that every interaction causes the entire editor to flash. It's bad enough when scrolling is involved. It's particularly concerning when the user types anything (anywhere, including the sidebar).
After
https://d.pr/v/I3uOyb
Wayyyy less repainting! Notice when typing, the repaint is contained in the typing area (e.g. RichText or
input
)How has this been tested?
This has been tested in local Gutenberg across Chrome, Firefox, and Safari.
npm install
npm run dev
Certain things to pay attention to. Anything involving popovers (e.g. Toolbar, color picker).
For visual repaint testing...
Types of changes
<Popover.Slot />
for BlockToolbartranslate3d(0, 0, 0)
for various elementsChecklist:
Resolves: #23427