Skip to content

perf(table): only check changed ranges for nested tables - #9576

Merged
mejo- merged 1 commit into
mainfrom
perf/tables
Nov 9, 2026
Merged

mejo- merged 1 commit into
mainfrom
perf/tables

Conversation

@mejo-

@mejo- mejo- commented Nov 9, 2026

Copy link
Copy Markdown
Member

The filter preventing nested tables walked the whole document on every document change and resolved the position of every table, row and cell. Resolving is linear in the number of siblings, so typing in a long table got slower with every row.

A nested table can only appear in content changed by the transaction, so only check the changed ranges, skip textblocks and only check table nodes: rows, cells, headers and captions can only exist inside a table.

Benchmark on a 500 kB document with one table of 2,262 rows, median per keystroke in a cell in the middle of the table, before -> after:

Chromium:

  • typing: 795 ms -> 672 ms
  • toggle bold (Ctrl+B): 797 ms -> 599 ms

Firefox:

  • typing: 730 ms -> 487 ms
  • toggle bold (Ctrl+B): 936 ms -> 319 ms

Related to #908

Assisted-by: ClaudeCode:claude-opus-5-5

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI tools
  • The AI-generated content was reviewed, comprehended and tested by a human

The filter preventing nested tables walked the whole document on every
document change and resolved the position of every table, row and cell.
Resolving is linear in the number of siblings, so typing in a long table
got slower with every row.

A nested table can only appear in content changed by the transaction, so
only check the changed ranges, skip textblocks and only check table nodes:
rows, cells, headers and captions can only exist inside a table.

Benchmark on a 500 kB document with one table of 2,262 rows, median per
keystroke in a cell in the middle of the table, before -> after:

Chromium:
- typing:              795 ms -> 672 ms
- toggle bold (Ctrl+B): 797 ms -> 599 ms

Firefox:
- typing:              730 ms -> 487 ms
- toggle bold (Ctrl+B): 936 ms -> 319 ms

Related to #908

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
@mejo- mejo- self-assigned this Nov 9, 2026
@github-project-automation github-project-automation Bot moved this to 🧭 Planning evaluation (don't pick) in 📝 Productivity team Nov 9, 2026
@mejo- mejo- moved this from 🧭 Planning evaluation (don't pick) to 👀 In review in 📝 Productivity team Nov 9, 2026
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Nov 9, 2026
@mejo-
mejo- merged commit 7d70f97 into main Nov 9, 2026
63 of 65 checks passed
@mejo-
mejo- deleted the perf/tables branch November 9, 2026 10:32
@github-project-automation github-project-automation Bot moved this from 👀 In review to ☑️ Done in 📝 Productivity team Nov 9, 2026
@mejo-

mejo- commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

/backport to stable35

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

Projects

Status: ☑️ Done

Development

Successfully merging this pull request may close these issues.

3 participants