You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web-Editor chokes on larger texts (performance issue) #908
Alternatively, mark all text in the markdown viewer (e.g. mouse-based, or CTRL+A) and do the same.
(Notice the lags.)
Nextcloud version: 18.0.6
Browser log
In my case, the sync POST request shows ~1 KB of data. After clicking on the "make bold" icon, it takes a second until the text is displayed in bold (and a 806 byte push event). The longer the text, the more laggy does the UI seem to be. I had a user jump back to google docs because of that :( . The same text felt snappier in Collabora Online/Office.
It seems that the lags occur through client based processing, as push event is shown in the network log only after the second(s) of delay, but here I do not have enough insights into how and when the logging is done (only after all processing?).
Could you share some details on which browser/OS you are using, as I cannot see any concrete performance issue with a 500kb contatining that wikipedia article multiple times.
Could you share some details on which browser/OS you are using, as I cannot see any concrete performance issue with a 500kb contatining that wikipedia article multiple times.
Sure. My document is ~560kb. Firefox 78.0.2 (64-bit), XUbuntu 18.04 (although not using xfce).
I have to say that the lag now is considerably smaller than when reported, and it believe it makes a difference whether the change is done in the beginning of the document vs at the end of the document.
Still, pressing CTRL+A (to mark all text) lets firefox report me that a page is slowing down my browser and asking whether I want to stop it.
@fwolfst Could you try again with a recent version of Nextcloud? I think the responsiveness of large files has improved a lot except for a few corner cases.
I just tried this on our Nextcloud 24 instance and had no sluggishness what so ever - however I'm running on a fairly fast computer and the server has quite a bit of resources too. So would be nice if you could try to confirm.
I copied the big data from the wiki link in the description of the task and then pasted it into the md file. It causes lag when clicking on the icon bold and when scrolling.
Would be good to do some profiling of a slow editing session to see what's keeping the editor busy.
I remember we used to serialize the document on every update - i.e. in on every keystroke. Not sure if we still do this but it's the first thing I would check for.
We have a report #908 about Text frontend becoming laggy with large documents (500kb or more). Can you please test this yourself against nextcloud.local with documents with different contents (long simple markdown, long tables, many attachments) and identify what's the bottleneck and what we can do about it?
Here's it's answer:
What's slow
The whole document is converted to markdown on every keystroke (CollaborativeEditor.vue:679, the onUpdate handler). That conversion is also quadratic in Chromium: prosemirror-markdown 1.13.9 checks the last character of its output after every write, and Chromium's JS engine copies the whole growing string each time it does. It takes 850 ms at 500 kB and 3.7 s at 1 MB. Firefox doesn't have this problem (9 ms). In the default Files/Viewer setup nothing uses the result of the per-keystroke conversion. This is what Max suspected in the issue.
The nested-table check on every edit (src/nodes/Table/TableCell.ts:64) walks the whole document and looks up the position of every table, row and cell. That lookup is itself linear, so long tables cost about 300 ms per keystroke here.
Every table row is its own Vue component (TableRowView with its own actions menu). Tiptap makes each one recompute its position on every cursor move, and that is linear too. On the 2,260-row table this costs 50 ms in Chromium and 110–170 ms in Firefox per keystroke or arrow key. When I removed those listeners in the page, Firefox went from 170 to 44 ms for arrow keys and to about 100 ms for typing. The class involved isn't exported by Tiptap, so Text can't override it.
It also came with concrete code changes to tackle some of the detected issues. @silverkszlo shall we have a look together or shall I open a PR and we discuss the changes from there?
Activity
fwolfst commentedon Jun 27, 2020
I also posted this in https://help.nextcloud.com/t/built-in-document-editor-chokes-on-medium-sized-files/85684 (no answer in the last two days).
[-]Web-Editor chokes on larger texts[/-][+]Web-Editor chokes on larger texts (performance issue)[/+]juliusknorr commentedon Jul 15, 2020
Could you share some details on which browser/OS you are using, as I cannot see any concrete performance issue with a 500kb contatining that wikipedia article multiple times.
fwolfst commentedon Jul 15, 2020
Sure. My document is ~560kb. Firefox 78.0.2 (64-bit), XUbuntu 18.04 (although not using xfce).
I have to say that the lag now is considerably smaller than when reported, and it believe it makes a difference whether the change is done in the beginning of the document vs at the end of the document.
Still, pressing CTRL+A (to mark all text) lets firefox report me that a page is slowing down my browser and asking whether I want to stop it.
max-nextcloud commentedon Aug 29, 2022
@a4bits that sounds like a different issue entirely. Are you still seeing this? Please open a new issue for it and include your app version.
max-nextcloud commentedon Aug 29, 2022
@fwolfst Could you try again with a recent version of Nextcloud? I think the responsiveness of large files has improved a lot except for a few corner cases.
I just tried this on our Nextcloud 24 instance and had no sluggishness what so ever - however I'm running on a fairly fast computer and the server has quite a bit of resources too. So would be nice if you could try to confirm.
luka-nextcloud commentedon Nov 6, 2022
I copied the big data from the wiki link in the description of the task and then pasted it into the md file. It causes lag when clicking on the icon bold and when scrolling.
blizzz commentedon Oct 28, 2026
Today, after I report, I tried with a 500kB file (essentially a big long table), and it was already quite laggy as well. On Firefox.
Another report claimed a 900kb file (with three dozen images and a table) being practically unusable (also on Firefox).
max-nextcloud commentedon Nov 2, 2026
Would be good to do some profiling of a slow editing session to see what's keeping the editor busy.
I remember we used to serialize the document on every
update- i.e. in on every keystroke. Not sure if we still do this but it's the first thing I would check for.mejo- commentedon Nov 2, 2026
I asked Claude the following:
Here's it's answer:
What's slow
CollaborativeEditor.vue:679, the onUpdate handler). That conversion is also quadratic in Chromium: prosemirror-markdown 1.13.9 checks the last character of its output after every write, and Chromium's JS engine copies the whole growing string each time it does. It takes 850 ms at 500 kB and 3.7 s at 1 MB. Firefox doesn't have this problem (9 ms). In the default Files/Viewer setup nothing uses the result of the per-keystroke conversion. This is what Max suspected in the issue.src/nodes/Table/TableCell.ts:64) walks the whole document and looks up the position of every table, row and cell. That lookup is itself linear, so long tables cost about 300 ms per keystroke here.TableRowViewwith its own actions menu). Tiptap makes each one recompute its position on every cursor move, and that is linear too. On the 2,260-row table this costs 50 ms in Chromium and 110–170 ms in Firefox per keystroke or arrow key. When I removed those listeners in the page, Firefox went from 170 to 44 ms for arrow keys and to about 100 ms for typing. The class involved isn't exported by Tiptap, so Text can't override it.It also came with concrete code changes to tackle some of the detected issues. @silverkszlo shall we have a look together or shall I open a PR and we discuss the changes from there?
perf(editor): only serialize markdown on update when it is read
perf(editor): only serialize markdown on update when it is read
perf(editor): only serialize markdown on update when it is read
perf(editor): only serialize markdown on update when it is read
mejo- commentedon Nov 9, 2026
The Markdown serialization bottleneck was addressed upstream in ProseMirror with https://code.haverbeke.berlin/prosemirror/prosemirror-markdown/commit/85f196373989569aff723dadb7d742a2d8d1caba and in Text with #9525.
For improving performance with many Tiptap vue node views, I opened ueberdosis/tiptap#8705.
perf(table): only check changed ranges for nested tables
perf(table): only check changed ranges for nested tables