Slow performance of WYSIWYG editor (CKEditor)

Hello everyone,

we experience big problems with performance when editing documents with the realtime WYSIWYG editor (CkEditor). It is working just fine for smaller documents, but for anything with a bit more content the editing experience is painfully slow. Sometimes it takes multiple seconds for key inputs even on documents that I would not consider to be “unusually large”.

My first thought was that it is probably caused by the realtime session. But using browser debugging tools, it looks like the slowness and lagging originates from the JavaScript execution time. I know that the performance of the CKEditor integration has been discussed before (for example in this post) but it always seemed like the problems have been resolved or were not that severe in the first place. I also know there are plans for a new editor, but it looks like it will take some time for that to arrive.

This is the performance trace of a keyup event on a mostly empty wiki page:

This is the trace on a page with more content:

A single keyup event takes more than 160ms of processing time. And that is not even the worst I have seen. Task manager shows super high CPU usage when typing at regular speed and scipt execution times pile up to multiple seconds. Most of the time is spend in ckeditor.js and various recursive function calls, most of the call stacks ending with String.replace.

I have a sample document: Download Link
I started with a blank document and progressivly added more content and tested the typing performance. At first, everything works just fine but at some point it starts slowing down. The document is now at the point where you can feel the editor start lagging when typing at regular speed.

I am wondering if that is really just the way the editor works and we have to get used to the performance it or if there is something wrong or something could be optimized. As of now, the editor is not usable for a large portion of documents in our wiki, even ones I would consider medium sized.

Environment:

  • XWiki 17.6.0
  • Browser: current versions of Chrome and Firefox