Repository navigation
Commit 60acb25
perf: smaller startup bundle, cached encodings and faster command registration (#2931)
* perf: shrink startup bundle and cache native encodings
- Load lib/run (markdown-it, its plugins and the markdown preview) on
first run/preview instead of in main.js.
- Load mime-types and its MIME database on demand at each lookup site.
- Skip load-time validation for bundled editor themes; they are still
validated when applied, and plugin themes are still validated when
registered.
- Cache the Android charset list per app build, OS version and device
model instead of rebuilding it natively on every launch.
- Fetch the sidebar app chunks in parallel while adding them in their
original order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf: make command registration and keymap rebuilds cheap
Each command registration (including every plugin addCommand) rebuilt the
whole keymap, re-parsing both key strings for every pairwise conflict
check, and immediately reconfigured every editor pane. Profiling on a
device showed ~1.8s of main-thread CPU spent here while plugins loaded.
- Cache canonicalized key strings; the result depends only on the input.
- Find the first conflicting claim without copying the claimed-keys map
for every candidate.
- Rebuild the keymap lazily: registration marks it dirty and every
reader rebuilds first, so reads stay current. The returned command
still has its final key and description immediately.
- Apply keymap refreshes once per burst in a microtask, which always
runs before the next key event.
- Drop the module-load rebuild that setKeyBindings immediately repeated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 5a7cc93 commit 60acb25
17 files changed
Lines changed: 365 additions & 61 deletions
File tree
- src
- cm
- themes
- fileSystem
- lib
- pages
- fileBrowser
- plugin
- sidebarApps
- utils
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
| |||
164 | 174 | | |
165 | 175 | | |
166 | 176 | | |
167 | | - | |
168 | 177 | | |
169 | 178 | | |
170 | 179 | | |
| |||
1514 | 1523 | | |
1515 | 1524 | | |
1516 | 1525 | | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
1517 | 1548 | | |
1518 | 1549 | | |
1519 | 1550 | | |
1520 | 1551 | | |
1521 | 1552 | | |
1522 | | - | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
| 1553 | + | |
1530 | 1554 | | |
1531 | 1555 | | |
1532 | 1556 | | |
| |||
1551 | 1575 | | |
1552 | 1576 | | |
1553 | 1577 | | |
1554 | | - | |
1555 | | - | |
1556 | | - | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
1557 | 1587 | | |
1558 | 1588 | | |
1559 | 1589 | | |
| |||
1596 | 1626 | | |
1597 | 1627 | | |
1598 | 1628 | | |
| 1629 | + | |
1599 | 1630 | | |
1600 | 1631 | | |
1601 | 1632 | | |
| |||
1643 | 1674 | | |
1644 | 1675 | | |
1645 | 1676 | | |
| 1677 | + | |
1646 | 1678 | | |
1647 | 1679 | | |
1648 | 1680 | | |
| |||
1651 | 1683 | | |
1652 | 1684 | | |
1653 | 1685 | | |
| 1686 | + | |
1654 | 1687 | | |
1655 | 1688 | | |
1656 | 1689 | | |
1657 | 1690 | | |
| 1691 | + | |
1658 | 1692 | | |
1659 | 1693 | | |
1660 | 1694 | | |
1661 | 1695 | | |
| 1696 | + | |
1662 | 1697 | | |
1663 | 1698 | | |
1664 | 1699 | | |
1665 | 1700 | | |
| 1701 | + | |
1666 | 1702 | | |
1667 | 1703 | | |
1668 | 1704 | | |
1669 | 1705 | | |
| 1706 | + | |
1670 | 1707 | | |
1671 | 1708 | | |
1672 | 1709 | | |
| |||
1754 | 1791 | | |
1755 | 1792 | | |
1756 | 1793 | | |
| 1794 | + | |
| 1795 | + | |
1757 | 1796 | | |
1758 | 1797 | | |
1759 | | - | |
| 1798 | + | |
1760 | 1799 | | |
1761 | 1800 | | |
1762 | 1801 | | |
| |||
1765 | 1804 | | |
1766 | 1805 | | |
1767 | 1806 | | |
1768 | | - | |
| 1807 | + | |
1769 | 1808 | | |
1770 | 1809 | | |
1771 | 1810 | | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
1772 | 1815 | | |
1773 | 1816 | | |
1774 | | - | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
1775 | 1835 | | |
1776 | 1836 | | |
1777 | 1837 | | |
| |||
1827 | 1887 | | |
1828 | 1888 | | |
1829 | 1889 | | |
1830 | | - | |
| 1890 | + | |
1831 | 1891 | | |
| 1892 | + | |
1832 | 1893 | | |
1833 | 1894 | | |
1834 | 1895 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
50 | 60 | | |
51 | 61 | | |
52 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
119 | 132 | | |
120 | 133 | | |
121 | 134 | | |
| |||
129 | 142 | | |
130 | 143 | | |
131 | 144 | | |
132 | | - | |
| 145 | + | |
133 | 146 | | |
134 | 147 | | |
135 | 148 | | |
| |||
164 | 177 | | |
165 | 178 | | |
166 | 179 | | |
167 | | - | |
168 | | - | |
169 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
170 | 189 | | |
171 | 190 | | |
172 | 191 | | |
173 | 192 | | |
174 | 193 | | |
175 | 194 | | |
176 | | - | |
| 195 | + | |
177 | 196 | | |
178 | 197 | | |
179 | 198 | | |
180 | 199 | | |
181 | 200 | | |
182 | 201 | | |
183 | | - | |
| 202 | + | |
184 | 203 | | |
185 | 204 | | |
186 | 205 | | |
187 | 206 | | |
188 | 207 | | |
189 | 208 | | |
190 | | - | |
191 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
192 | 217 | | |
193 | 218 | | |
194 | 219 | | |
195 | 220 | | |
196 | 221 | | |
197 | 222 | | |
198 | | - | |
| 223 | + | |
199 | 224 | | |
200 | 225 | | |
201 | 226 | | |
202 | 227 | | |
203 | 228 | | |
204 | 229 | | |
205 | | - | |
| 230 | + | |
206 | 231 | | |
207 | 232 | | |
208 | 233 | | |
209 | 234 | | |
210 | 235 | | |
211 | 236 | | |
212 | | - | |
| 237 | + | |
213 | 238 | | |
214 | 239 | | |
215 | 240 | | |
216 | 241 | | |
217 | 242 | | |
218 | 243 | | |
219 | | - | |
| 244 | + | |
220 | 245 | | |
221 | 246 | | |
222 | 247 | | |
223 | 248 | | |
224 | 249 | | |
225 | 250 | | |
226 | | - | |
| 251 | + | |
227 | 252 | | |
228 | 253 | | |
229 | 254 | | |
230 | 255 | | |
231 | 256 | | |
232 | 257 | | |
233 | | - | |
| 258 | + | |
234 | 259 | | |
235 | 260 | | |
236 | 261 | | |
237 | 262 | | |
238 | 263 | | |
239 | 264 | | |
240 | | - | |
| 265 | + | |
241 | 266 | | |
242 | 267 | | |
243 | 268 | | |
244 | 269 | | |
245 | 270 | | |
246 | 271 | | |
247 | | - | |
| 272 | + | |
248 | 273 | | |
249 | 274 | | |
250 | 275 | | |
251 | 276 | | |
252 | 277 | | |
253 | 278 | | |
254 | | - | |
| 279 | + | |
255 | 280 | | |
256 | 281 | | |
257 | 282 | | |
258 | 283 | | |
259 | 284 | | |
260 | 285 | | |
261 | | - | |
| 286 | + | |
262 | 287 | | |
263 | 288 | | |
264 | 289 | | |
265 | 290 | | |
266 | 291 | | |
267 | 292 | | |
268 | | - | |
| 293 | + | |
269 | 294 | | |
270 | 295 | | |
271 | 296 | | |
272 | 297 | | |
273 | 298 | | |
274 | 299 | | |
275 | | - | |
| 300 | + | |
276 | 301 | | |
277 | 302 | | |
278 | 303 | | |
| |||
281 | 306 | | |
282 | 307 | | |
283 | 308 | | |
284 | | - | |
| 309 | + | |
285 | 310 | | |
286 | 311 | | |
287 | 312 | | |
| |||
0 commit comments