-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Domain: PerformanceReports of unusually slow behaviorReports of unusually slow behaviorExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Bug Report
🔎 Search Terms
- fs.stat
- statSync
- performance
Problem
While working on web project wide IntelliSense, I noticed that TS makes a number of fs.statSync
calls for files stored under the global typings cache. At least some of these calls seem to be unnecessary, such as here where we check for files called mkdirp.ts
, mkdirp.tsx
, mkdirp.d.ts
directly under node_modules
:
/Users/matb/Library/Caches/typescript/4.9/node_modules/mkdirp
/Users/matb/Library/Caches/typescript/4.9/node_modules
/Users/matb/Library/Caches/typescript/4.9/node_modules/mkdirp.ts
/Users/matb/Library/Caches/typescript/4.9/node_modules/mkdirp.tsx
/Users/matb/Library/Caches/typescript/4.9/node_modules/mkdirp.d.ts
/Users/matb/Library/Caches/typescript/4.9/node_modules/mkdirp
I don't think these specific files would ever exist, would they?
These calls are relatively fast on desktop but do have more of an overhead on web. Even on desktop, I see around 250ms total spent on all the stat calls when starting TS Server in a simple project
Can we avoid making these calls?
tonivj5
Metadata
Metadata
Assignees
Labels
Domain: PerformanceReports of unusually slow behaviorReports of unusually slow behaviorExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript