Skip to content
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

Fake selection is updated regardless of whether it needs to be updated #4536

Closed
Reinmar opened this issue Sep 5, 2019 · 1 comment · Fixed by ckeditor/ckeditor5-engine#1792
Assignees
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@Reinmar
Copy link
Member

Reinmar commented Sep 5, 2019

During image resizing the renderer is executed on every change of the image (I'm not sure who triggers the renderer, but it happens, and it just may happen, so let's accept this fact).

Unfortunately, the renderer doesn't check whether fake selection really needs to be updated so on every call it removes the native selection and sets it back in the same place.

This causes serious deoptimization – Chrome blocks rendering thread for a long periods, stacking some selection changes. It only renders (probably) when for a certain period of time it doesn't get any selection change.

@mlewand mlewand self-assigned this Sep 5, 2019
@Reinmar
Copy link
Member Author

Reinmar commented Sep 5, 2019

Look how long this frame is and what's happening at the end of it:

image

By inspecting this frame's content we realised that those selection changes may be some sort of blocker for the renderer thread. It's not 100% clear why browser delays rendering, but even though those selection changes are super short, they turned out to be blocking.

After we resolved this issue (with a hack for test purposes) Chrome immediately started to render after every mousemove interaction. Before this fix, there are multiple mousemove per frame.

Reinmar referenced this issue in ckeditor/ckeditor5-engine Sep 17, 2019
Fix: Improved performance when working with fake selections. Closes #1791.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 27 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. type:improvement This issue reports a possible enhancement of an existing feature. package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
2 participants