Skip to content

perf(editor-ext): faster array diff for page history compare - #2689

Merged
Philipinho merged 2 commits into
mainfrom
perf/recreate-transform-diff
Nov 12, 2026
Merged

Philipinho merged 2 commits into
mainfrom
perf/recreate-transform-diff

Conversation

@Philipinho

@Philipinho Philipinho commented Nov 11, 2026 •

Copy link
Copy Markdown
Member
Case Before (rfc6902 5.2.0) Now
1,000 typos 46.3 s 0.03 s
1,000 scattered 60.9 s 0.07 s
1,000 section rewrite 17.7 s 0.14 s
1,000 full rewrite 121 s 1.4 s
4,000 typos not runnable 0.10 s, 184 MB

- pass a banded array diff to rfc6902 createPatch, same patch as its own diffArrays
- bump rfc6902 to 5.4.0
- test the array diff against rfc6902's output
@socket-security

socket-security Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedrfc6902@​5.2.0 ⏵ 5.4.0100 +110010088 +7100

View full report

- apply each patch to a copy that shares untouched json
- reuse nodes built for unchanged json and skip rechecking them
- pin recreateTransform steps for edits across a page in tests
@Philipinho
Philipinho merged commit 3fc8273 into main Nov 12, 2026
6 checks passed
kurerere added a commit to kurerere/docmost that referenced this pull request Nov 16, 2026
…tream

* perf(search): rebuild tsvectors only when the indexed text changes (docmost#2684)

* refactor: keep page trees within their space (docmost#2681)

* feat(ee): announcements (docmost#2683)

* New Crowdin updates (docmost#2668)

* fix(collab): skip database migrations on the collab server (docmost#2685)

* feat(ee): disable export (docmost#2653)

* fix: update packages (docmost#2688)

* New Crowdin updates (docmost#2687)

* test(editor): leave tab strip drop cursor cleanup to the plugin (docmost#2691)

* chore(client): disable node web storage in vitest (docmost#2690)

* perf(editor-ext): faster array diff for page history compare (docmost#2689)

* feat(history): highlight formatting-only changes  (docmost#2692)

* fix: skip unchanged history versions (docmost#2693)

* feat(ee): API key scopes (docmost#2694)

* feat(history): configurable page history interval (docmost#2696)

* fix(history): record versions for pages with no content (docmost#2697)

- skip mention and internal link extraction when page content is null
- fixes submit for approval and verify on never-edited pages

* fix(history): let wide tables scroll in the history modal (docmost#2699)

* fix: base cursor precision (docmost#2701)

* refactor: list shares through the share service (docmost#2703)

* feat(ee): base csv import (docmost#2700)

* fix(ee): cap API key expiration at 3 years (docmost#2704)

* refactor(mail): adjust account email links (docmost#2705)

* feat: status filter for space, announcement and member lists (docmost#2706)

* fix: reload member lists after a member's status changes (docmost#2707)

* fix: editor performance (docmost#2702)

* fix: editor followup (docmost#2708)

* fix(editor): resync collaboration after restoring editor state
* fix(editor): release destroyed collaboration views
* perf(editor): skip attribute scans without custom views

---------

Co-authored-by: Philip Okugbe <[email protected]>
@vicocotea

Copy link
Copy Markdown

Hi @Philipinho! I've just opened chbrown/rfc6902#117, a simple speedup for rfc6902's array diff (a fast equality check, like your jsonEqual). Your diffJsonArrays and its banded, Ukkonen-style approach is much better though: it gives the same patches as rfc6902, is faster than my version, and is MUCH faster than the original.

Would you be OK with me porting it to rfc6902 in a PR, with credit to you? Since Docmost is AGPL and rfc6902 is MIT, I'd rather ask first. And if you'd prefer to open that PR yourself, even better.

@Philipinho

Copy link
Copy Markdown
Member Author

Hi @vicocotea, go for it. You have my permission.
Just curious, how did you find this PR?

@vicocotea

Copy link
Copy Markdown

Thanks a lot! I came across it while looking at rfc6902's dependents / performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants