Closed
Description
Related to #52695
Bug Report
🔎 Search Terms
- fs.stat
- statSync
- performance
Problem
Create a simple project with a single .js
file and a node_modules
directory. I noticed that this results in typescript checking for the existence of the standard lib files under node_modules/@typescript
:
stat /Users/matb/projects/san/node_modules/@typescript/lib-es2015/promise
stat /Users/matb/projects/TypeScript/built/local/lib.es2015.promise.d.ts
stat /Users/matb/projects/TypeScript/built/local/lib.es2015.promise.d.ts
readFile 45444 0.0653829574584961ms /Users/matb/projects/TypeScript/built/local/lib.es2015.promise.d.ts
It makes two of these checks for every lib
file, even though node_modules/@typescript
does not exist. The results in 100 or so extra stat calls when you open a simple project consisting of a single .js
file
Could we avoid hitting the file system if the parent node_modules/@typescript
directory not exist? These calls are fast enough on desktop but are slower on web