Commit c1cf230
committed
perf(lsp): compile naming-diagnostic regexes once, not per call
lspNamingDiagnostic recompiled 3 constant regexes on every call; LSP runs
diagnostics on every document change, so regexp.compile was ~67% of
LSPComputeDiagnostics's allocations. Hoisted to package-level vars.
LSPComputeDiagnostics: 186->47 allocs/op, 23922->8475 B/op, 12162->6061 ns/op.
Behaviour byte-identical (LSP tests green).
Co-Authored-By: Virgil <virgil@lethean.io>1 parent 7194031 commit c1cf230
1 file changed
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
528 | 538 | | |
529 | 539 | | |
530 | 540 | | |
531 | 541 | | |
532 | 542 | | |
533 | 543 | | |
534 | 544 | | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
544 | 548 | | |
545 | 549 | | |
546 | 550 | | |
| |||
0 commit comments