Ckeditor5: Performance concerns when dealing with multiple formatting attributes

Created on 1 Apr 2019  Â·  6Comments  Â·  Source: ckeditor/ckeditor5

  1. Set the following data in the docs (ckeditor5/build/docs/ckeditor5/12.0.0/features/remove-format.html):
<p><code><i><s><strong><sub><sup><u>You can use the remove format feature to easily clean up text formatting.</u></sup></sub></strong></s></i></code></p><p><code><i><s><strong><sub><sup><u>Some examples of the formatting removed by this feature: bold, italics, underline, strikethrough, code, subscript, superscript, </u></sup></sub></strong></s></i></code><span class="text-tiny"><code><i><s><strong><sub><sup><u>font size</u></sup></sub></strong></s></i></code></span><code><i><s><strong><sub><sup><u> as well as </u></sup></sub></strong></s></i></code><span style="font-family:'Courier New', Courier, monospace;"><code><i><s><strong><sub><sup><u>font family</u></sup></sub></strong></s></i></code></span><code><i><s><strong><sub><sup><u>.</u></sup></sub></strong></s></i></code></p><p style="text-align:center;"><code><i><s><strong><sub><sup><u>Remove format resets the text alignment too.</u></sup></sub></strong></s></i></code></p><p><code><i><s><strong><sub><sup><u>Note: The feature will not erase non-formatting content — </u></sup></sub></strong></s></i></code><a href="https://ckeditor.com"><code><i><s><strong><sub><sup><u>your links</u></sup></sub></strong></s></i></code></a><code><i><s><strong><sub><sup><u> are safe!</u></sup></sub></strong></s></i></code></p>
  1. Click remove format.

Expected: Formatting is removed ASAP

Actual: It takes more than 3s to remove the formatting on a quad core i7. It's just a few paragraphs.

Undoing the operation also takes a lot of time. Probably there are too many deltas produced during the operation.

cc @mlewand @scofalik

remove-format duplicate bug

Most helpful comment

Wow, I've just checked this and the result is 0.2s. It was 3s before, so we have more than 10x improvement :exploding_head: 

All 6 comments

Just to let you know: the sample I provided is not the most common use–case. 4 or 5 formatting attributes on the same chunk of text are not very common, so it's not a high priority issue.

I can confirm this problem, experiencing same issue.

Most of the execution time goes to model._runPendingChanges. Looks like a generic issue that should be fixed in the engine:

profiler screenshot

model._runPendingChanges is the method which wraps... basically everything. The first half of this log are all changes in the model and converting it to view and the second half is rendering it to DOM. So it is not surprise it takes most of the time since it do most of the things :D

Don't get me wrong. I do not say there is nothing to be optimise, but everything to be optimised in the editor is somewhere inside _runPendingChanges.

@pjasiun sure, I'm just showing that the problem exist. As for pointing out the exact place where issue occurs, I intentionally skipped going into details - we'll get back to this as we have more time to fix this properly.

Wow, I've just checked this and the result is 0.2s. It was 3s before, so we have more than 10x improvement :exploding_head: 

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pomek picture pomek  Â·  3Comments

Reinmar picture Reinmar  Â·  3Comments

Reinmar picture Reinmar  Â·  3Comments

pjasiun picture pjasiun  Â·  3Comments

MansoorJafari picture MansoorJafari  Â·  3Comments