-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Performance improvement in case of empty mutations #5600
Comments
IMO, we shouldn't also fire the viewDoc#mutations event when there are no view mutations, so I tihnk it should look like this: if ( viewMutations.length ) {
this.document.fire( 'mutations', viewMutations, viewSelection );
// If nothing changes on `mutations` event, at this point we have "dirty DOM" (changed) and de-synched
// view (which has not been changed). In order to "reset DOM" we render the view again.
this.view.forceRender();
} This helps a bit with @mlewand's image resizer performance issue too. |
Fix: Changes irrelevant to the view (e.g. inside UIElements) will no longer force a view render nor will they trigger mutation event on the document. Closes ckeditor/ckeditor5#5600.
I want to make sure about one thing – that no elements are "markToSynced" when we abort from calling |
The first thing I checked is that Now, Therefore, I started wondering if skipping So, are we able to log something to the console in fishy situations? Unfortunately, I can't see a condition on which we could base that message. I made some quick checks though. I added a warning in the So, then I started removing bogus Then I checked the same for:
To check if removal of 7ZWS (the inline filling character) can be restored. I was pressing Cmd+B and waited for the filler to be removed. It wasn't then restored correctly plus some error was thrown from the renderer. That's very similar on master and before our changes.
Anyway, as we can see, we're not handling those situations anyway. Apparently, they didn't occur in real life often enough for us to focus on them. Let's see then. If we'll hit some regressions, we'll know where to look for for a moment despite lack of a console warning. |
Extracted from ckeditor/ckeditor5-widget#108
Regarding this part
I think we could get rid of it completely
if we optimized
_onMutations()
that callsview.forceRender()
whether there are view mutations or not.For instance, when the image is resized, DOM (character) mutations are triggered for the label displaying the current size. We filter them out (which makes sense) but we call
view.forceRender()
anyway later on.I'm not an expert in this area but I guess we could terminate earlier if mutations come from within an
UIElement
. Is there any use–case for callingview.forceRender()
in such a situation?I did this
and engine tests were all green.
cc @scofalik
The text was updated successfully, but these errors were encountered: