Skip to content

[stable33] perf(editor): only serialize markdown on update when it is read - #9544

Merged
mejo- merged 1 commit into
stable33from
backport/9543/stable33
Nov 4, 2026
Merged

mejo- merged 1 commit into
stable33from
backport/9543/stable33

Conversation

@backportbot

@backportbot backportbot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Backport of #9543

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot
backportbot Bot requested a review from mejo- November 4, 2026 16:40
@backportbot backportbot Bot added bug Something isn't working 3. to review performance 🚀 labels Nov 4, 2026
@backportbot backportbot Bot added this to the Nextcloud 33.0.11 milestone Nov 4, 2026
CollaborativeEditor serialized the whole document to markdown on every
editor update to emit `update:content`, even when no listener uses the
result. On large documents this blocks every keystroke, especially in
Chromium where prosemirror-markdown's serializer is quadratic in the
output size.

Emit the markdown as a getter so it is only serialized when a listener
reads it.

Benchmark on a 500 kB markdown document (headings, paragraphs, lists
with marks), headless browsers against a local instance, median per
step, before -> after:

Chromium:
- typing (cursor at start):  981 ms -> 67 ms
- typing (cursor at end):    933 ms -> 34 ms
- toggle bold on a word:     930 ms -> 50 ms
- editor update handlers:    ~870 ms -> <1 ms

Firefox:
- typing (cursor at start):  125 ms -> 76 ms
- typing (cursor at end):     55 ms -> 47 ms
- toggle bold on a word:      67 ms -> 88 ms (within noise)
- editor update handlers:     ~9 ms -> 1 ms

Large tables are not affected by this change; their cost lies elsewhere.

Related to #908

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
@mejo-
mejo- force-pushed the backport/9543/stable33 branch from a4107fe to fa533e1 Compare November 4, 2026 16:41
@mejo- mejo- changed the title [stable33] [stable34] perf(editor): only serialize markdown on update when it is read [stable33] perf(editor): only serialize markdown on update when it is read Nov 4, 2026
@mejo-
mejo- marked this pull request as ready for review November 4, 2026 16:42
@mejo-
mejo- merged commit 53b20eb into stable33 Nov 4, 2026
62 of 66 checks passed
@mejo-
mejo- deleted the backport/9543/stable33 branch November 4, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant