-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip stat call / throwing an exception when source files don't exist #225
Skip stat call / throwing an exception when source files don't exist #225
Conversation
Unbelievable find @robstolarz. Want to note to the maintainer and anyone who sees this PR, if you try to upgrade and use this, you may notice that you don't see the 6x benefit immediately. However, what I found is that if you for some reason have two
|
@jonaskello Any thoughts on when you might be able to review this? We'd like to get this change moving as soon as possible |
Codecov ReportBase: 68.28% // Head: 68.16% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #225 +/- ##
==========================================
- Coverage 68.28% 68.16% -0.12%
==========================================
Files 9 9
Lines 309 311 +2
Branches 95 96 +1
==========================================
+ Hits 211 212 +1
- Misses 92 93 +1
Partials 6 6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Seems like a straightforward change so I think we can just merge and release in a patch version. |
Release in 4.1.1 |
Thanks so much for the quick turnaround!! |
The version 4.1.1 of `tsconfig-paths` includes a performance fix, that can improve resolve speed by 10-20% in repositories with many files. See: dividab/tsconfig-paths#225
I noticed that as the number of tried file paths goes up, Node.js spends a lot of time preparing a native exception to throw over the JS barrier. I narrowed this down to be a result of relying on the
fs.statSync
call infileExistsSync
to determine whether or not the file exists on top of whether or not it is actually a file.Prepending a call to
fs.existsSync
allows us to skip the preparation time of throwing an exception at the cost of causing another IO hit. There is ostensibly some sort of tradeoff but for the large monolithic app I work on, this shaves off the vast majority of the boot and hot reload time.[1]Happy to discuss / prepare a more detailed breakdown if necessary.
1: 6x improvement in boot time on ~6k JS source files