-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
jest-resolve 18% performance optimization #8183
jest-resolve 18% performance optimization #8183
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8183 +/- ##
=========================================
- Coverage 62.32% 62.3% -0.02%
=========================================
Files 265 265
Lines 10469 10477 +8
Branches 2545 2545
=========================================
+ Hits 6525 6528 +3
- Misses 3361 3366 +5
Partials 583 583
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea to use the map internally :)
😮 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome!
(aaaaand changelog :D)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm so glad you are looking into this. fyi if you can improve jest-resolve's performance, you may be able to significantly speed up the runtime of all tests. It's been my dream to work on this but never got around to it :D
This is great @scotthovestadt! I investigated this some time ago when I landed a similar change in the haste map (#6960) but back then it didn't seem to make a significant difference. I'm glad it makes now! :D |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
jest-resolve
is called heavily byjest-resolve-dependencies
when finding related tests. Benchmarking the simple change fromObject
toMap
for the internal cache shows an 18% improvement in the total run time ofdependencyResolver.resolveInverse
for a test data set of 300k~ files, although obviously the performance characteristics are going to vary depending on the data set.At Facebook, this PR means when I run just Jest to look at my changed files and run the appropriate tests, it boots up 2 seconds faster.
Test plan