Performance with large number of editors
📝 Provide a description of the improvement
ckeditor5 seems to be slow with a large number of editors.
If I put one editor on screen but with a large amount of content it renders pretty fast.
But if I do a large number, say 100, it's very slow. Like 3000ms.
Are there any performance optimizations I could do here? Any docs on this?
📃 Other details
- Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
- OS: MacOS 11.0.1
- CKEditor version: 23.1.0
- Installed CKEditor plugins: only Paragraph to rule out plugin performance.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
I saw this comment on stackoverflow:
https://stackoverflow.com/questions/53609539/multiple-ckeditor5-in-one-page-performance-issue
I started working on a solution for this by making the HTML only editable on first click.
The main issue is how to set the cursor to where it was clicked when ckeditor mounts.
I know I can set the selection and I've played with that before but I have to translate the mouse event position click with where it would be in ckeditor and there's a slightly different DOM there inside the editor so I'd have to figure out how to map that.
If you guys have any pointers I don't mind writing something up on how to implement this in React.
Another thought.. .maybe a clone() feature for the editor such that you let ONE do the init and then you clone it over and over and over again.
Hi! 100 editors on one page would be indeed slow. Even worse, the memory footprint is huge and not something that could be improved significantly (if at all).
Could you write more about your use case – how's your app working that it needs 100 editors? I can imagine such cases, but just to be more confident on what's the real use case.
The use case is basically an outliner.
I had thought about building it as ul and li nodes and doing the whole thing inside ckeditor5 but my skillset is far more oriented around React. I'd have to build a pretty crazy plugin in ckeditor to do this otherwise.
The way I'm doing it now is to have a tree in React and then a ckeditor for each node.
I managed to get the performance respectable by removing all the plugins except for a few core plugins.
I attached the list of slow plugins below. I don't think there's a single cause slow plugin. It might be 2-3 of them but I haven't tracked them down.
Basically, without these, our ckeditor is about 5-10x faster in this use case.
slow plugins:
"CKFinder",
"Heading",
"TextTransformation",
"MediaEmbed",
"PasteFromOffice",
"Table",
"TableToolbar",
"TableProperties",
"TableCellProperties",
"TextTransformation"
Thanks for the details.
It's a good call to remove unnecessary plugins. Most of them add to the conversion process and that's what might have the biggest impact.
As for the other ideas – to make it easier to start an editor on "click", that's something interesting too. I think it's the most straightforward solution to the problem that someone might have countless editable regions. If we'd create some utils for this (e.g. something that helps setting the selection in the same place where the user clicked), that'd help a lot with many cases.
The second idea could be to allow adding and removing root from the editor dynamically. What's more, we could allow having countless cE=true regions (super cheap) that are not plugged to the editor. Then, on focus of such an area, the integration code would hook both things and the editor would start handling the following integrations. OTOH, this might be tricky in React/Vue/etc where the initial structure would be rendered by that framework and upon focus it would need to be taken over by CKE.
We're running into this performance issue as well, rendering a reasonable number of instances for a custom form in our React application via ckeditor5-react. I'm also happy to post an issue in that project, but https://github.com/ckeditor/ckeditor5-react/issues/93 was closed.
As @burtonator mentioned, this issue can be mostly attributed to plugins. For example, using 20 editors as a baseline, load times look like:
- ~1.3s without any plugins
- ~2.3s with a core set of plugins (see list below)
- ~5.4s with 4 additional table plugins (
Table,TableCellProperties,TableProperties,TableToolbar)
Here is a full list of the 22 plugins we are using
- Alignment
- Autoformat
- Bold
- Essentials
- FontBackgroundColor
- FontColor
- FontFamily
- FontSize
- Heading
- Italic
- Link
- List
- Paragraph
- PasteFromOffice
- RemoveFormat
- Strikethrough
- Table
- TableCellProperties
- TableProperties
- TableToolbar
- TextTransformation
- Underline
@Reinmar, is there any update on mitigating this issue? We appreciate the modular architecture of CKEditor 5, but some of these core plugins seem extremely expensive to initialize.
We suffer from the same issue, even 5-10 editors slow down the performance in around ~2 sec Any update?
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).