Commit 5acc6bc
committed
Optimize editor per-keystroke performance
Major bottlenecks identified via profiling and addressed:
Tables: skip full-document rebuild when the change doesn't touch any
Table node — map existing decorations through position changes instead.
Lists: consolidate 5 separate StateFields into a single ViewPlugin
scoped to visible ranges. The continuation-line check used a
full-tree scan per line — replaced with O(depth) resolveInner lookup.
Toolbar: getBlockType scanned every line for code fences — now checks
heading first (line-local) and only scans up to the cursor line.
UpdateListener: deduplicate doc.toString() calls, skip
countSearchMatches when no active query.
Inline images: skip collectSearchMatches + doc.toString() when there
is no active search query.
onChange: defer store update off the critical paint path with
setTimeout so the React re-render cascade doesn't block the keystroke.1 parent 6466309 commit 5acc6bc
5 files changed
Lines changed: 456 additions & 406 deletions
File tree
- app/src/features/editor
- extensions
- inline-images
- markdown-decorations
- builders
- lib
Lines changed: 26 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
292 | 308 | | |
293 | 309 | | |
294 | 310 | | |
| |||
364 | 380 | | |
365 | 381 | | |
366 | 382 | | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
371 | 386 | | |
372 | 387 | | |
373 | 388 | | |
| |||
381 | 396 | | |
382 | 397 | | |
383 | 398 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
388 | 402 | | |
389 | 403 | | |
390 | 404 | | |
| |||
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1070 | 1070 | | |
1071 | 1071 | | |
1072 | 1072 | | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1073 | 1115 | | |
1074 | 1116 | | |
1075 | 1117 | | |
| |||
1084 | 1126 | | |
1085 | 1127 | | |
1086 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1087 | 1134 | | |
1088 | 1135 | | |
1089 | 1136 | | |
| |||
1095 | 1142 | | |
1096 | 1143 | | |
1097 | 1144 | | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1098 | 1152 | | |
1099 | 1153 | | |
1100 | 1154 | | |
| |||
0 commit comments