When we first started working with the new parserOptions.projectService
(formerly parserOptions.EXPERIMENTAL_useProjectService
), it outperformed equivalent parserOptions.project
setups by ~10-15%. We still sometimes have users report to us that it improved their linting speed. trpc/trpc#5868 is an example of one observation I've made.
However, at some point since then, we've started to notice worse performance of parserOptions.projectService
in our own measurements. https://github.com/typescript-eslint/performance contains tooling to test this. From https://github.com/typescript-eslint/performance/blob/45f77c00c6d4384d466c39e8eb633a76f33dd019/README.md#results:
┌───────┬──────────────────────┬──────────────────────┬──────────────────────┬──────────────────────┐
│ files │ project (even) │ project (references) │ service (even) │ service (references) │
┼───────┼──────────────────────┼──────────────────────┼──────────────────────┼──────────────────────┤
│ 128 │ '1.149 s ± 0.030 s' │ '1.135 s ± 0.008 s' │ '1.178 s ± 0.010 s' │ '1.736 s ± 0.012 s' │
│ 512 │ '1.636 s ± 0.009 s' │ '1.656 s ± 0.004 s' │ '1.895 s ± 0.007 s' │ '2.613 s ± 0.020 s' │
│ 1024 │ '2.353 s ± 0.013 s' │ '2.399 s ± 0.016 s' │ '3.130 s ± 0.017 s' │ '4.034 s ± 0.061 s' │
┴───────┴──────────────────────┴──────────────────────┴──────────────────────┴──────────────────────┘
Summarizing those results, there seem to be two areas of slowness. Comparing project
to projectService
at ~1024 files:
(even)
), jumping from ~2.35s to ~3.13s(references)
): jumping from ~2.4s to ~4.0s⚠️ These measurements might be flawed. We are not sure there's not some external data polluting the results. This issue might just be tracking that we're measuring them incorrectly.
Also note that parserOptions.project
has been in production for years, with many performance optimizations around it. parserOptions.projectService
is very new and not yet stable. There is likely much more "low-hanging fruit" to optimize around parserOptions.projectService
.
We don't yet know whether this is an issue in TypeScript or typescript-eslint. It's probably typescript-eslint.
Relevant past issues:
Node.getChildren
speed regression in ts 5.5 when used at very large scale microsoft/TypeScript#59101
KostyaTretyak, austinw-fineart, rakyi, koooge and ricky-wong
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4