Commit 11bc4bc
perf: micro-optimizations in hot paths (#2960)
* perf: micro-optimizations in hot paths for faster completions and diagnostics
Replace O(n²) flatten() with Array.prototype.flat(), remove lodash flatten
dependency from PluginHost, use Object.create instead of object spread in
svelteNodeAt AST walking, cache getExistingImports per document, use
RegExp.test() over .match(), replace regex with charCode check in
possiblyComponent, use cached line offsets for lineCount, and optimize
iteration in SnapshotManager.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in PluginHost.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Create big-clocks-care.md
* fix: prettier formatting in changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* address pr feedback: remove flatten util, use charCodeAt, fix code style
- Replace all flatten() call sites with .flat()/.flatMap() and remove
the flatten utility function entirely
- Use charCodeAt(0) directly in possiblyComponent instead of char comparison
- Use block syntax for single-line for loops in SnapshotManager
- Remove ineffective existingImportsCache from CompletionProvider
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 95452d7 commit 11bc4bc
File tree
14 files changed
+136
-125
lines changed- .changeset
- packages/language-server/src
- lib/documents
- plugins
- css
- svelte/features
- typescript
- features
14 files changed
+136
-125
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
110 | | - | |
| 109 | + | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
| |||
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
194 | | - | |
195 | | - | |
| 192 | + | |
196 | 193 | | |
197 | 194 | | |
198 | 195 | | |
| |||
242 | 239 | | |
243 | 240 | | |
244 | 241 | | |
245 | | - | |
| 242 | + | |
246 | 243 | | |
247 | 244 | | |
248 | 245 | | |
249 | 246 | | |
250 | 247 | | |
251 | 248 | | |
252 | | - | |
| 249 | + | |
253 | 250 | | |
254 | 251 | | |
255 | 252 | | |
| |||
269 | 266 | | |
270 | 267 | | |
271 | 268 | | |
272 | | - | |
| 269 | + | |
273 | 270 | | |
274 | 271 | | |
275 | 272 | | |
276 | 273 | | |
277 | 274 | | |
278 | 275 | | |
279 | | - | |
| 276 | + | |
280 | 277 | | |
281 | 278 | | |
282 | 279 | | |
| |||
286 | 283 | | |
287 | 284 | | |
288 | 285 | | |
289 | | - | |
| 286 | + | |
290 | 287 | | |
291 | 288 | | |
292 | 289 | | |
293 | 290 | | |
294 | 291 | | |
295 | 292 | | |
296 | | - | |
| 293 | + | |
297 | 294 | | |
298 | 295 | | |
299 | 296 | | |
| |||
309 | 306 | | |
310 | 307 | | |
311 | 308 | | |
312 | | - | |
| 309 | + | |
313 | 310 | | |
314 | 311 | | |
315 | 312 | | |
316 | 313 | | |
317 | 314 | | |
318 | 315 | | |
319 | | - | |
| 316 | + | |
320 | 317 | | |
321 | 318 | | |
322 | 319 | | |
| |||
382 | 379 | | |
383 | 380 | | |
384 | 381 | | |
385 | | - | |
| 382 | + | |
386 | 383 | | |
387 | 384 | | |
388 | 385 | | |
389 | 386 | | |
390 | 387 | | |
391 | 388 | | |
392 | | - | |
| 389 | + | |
393 | 390 | | |
394 | 391 | | |
395 | 392 | | |
| |||
408 | 405 | | |
409 | 406 | | |
410 | 407 | | |
411 | | - | |
| 408 | + | |
412 | 409 | | |
413 | 410 | | |
414 | 411 | | |
415 | 412 | | |
416 | 413 | | |
417 | 414 | | |
418 | | - | |
| 415 | + | |
419 | 416 | | |
420 | 417 | | |
421 | 418 | | |
| |||
700 | 697 | | |
701 | 698 | | |
702 | 699 | | |
703 | | - | |
| 700 | + | |
704 | 701 | | |
705 | 702 | | |
706 | 703 | | |
707 | 704 | | |
708 | 705 | | |
709 | | - | |
| 706 | + | |
710 | 707 | | |
711 | 708 | | |
712 | 709 | | |
713 | 710 | | |
714 | 711 | | |
715 | 712 | | |
716 | | - | |
| 713 | + | |
717 | 714 | | |
718 | 715 | | |
719 | 716 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
403 | | - | |
404 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
Lines changed: 29 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
276 | | - | |
277 | | - | |
278 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
279 | 299 | | |
280 | 300 | | |
281 | 301 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
289 | 305 | | |
290 | 306 | | |
291 | 307 | | |
| |||
Lines changed: 27 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
1255 | 1254 | | |
1256 | 1255 | | |
1257 | 1256 | | |
1258 | | - | |
| 1257 | + | |
1259 | 1258 | | |
1260 | 1259 | | |
1261 | 1260 | | |
| |||
1449 | 1448 | | |
1450 | 1449 | | |
1451 | 1450 | | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
1456 | | - | |
1457 | | - | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | | - | |
1475 | | - | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1476 | 1457 | | |
1477 | 1458 | | |
1478 | 1459 | | |
1479 | 1460 | | |
1480 | 1461 | | |
1481 | 1462 | | |
1482 | | - | |
| 1463 | + | |
1483 | 1464 | | |
1484 | 1465 | | |
1485 | | - | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
1486 | 1483 | | |
1487 | | - | |
1488 | | - | |
| 1484 | + | |
| 1485 | + | |
1489 | 1486 | | |
1490 | 1487 | | |
1491 | 1488 | | |
| |||
0 commit comments