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.
|
thymikee
left a comment
There was a problem hiding this comment.
Great idea to use the map internally :)
😮 |
SimenB
left a comment
There was a problem hiding this comment.
awesome!
(aaaaand changelog :D)
cpojer
left a comment
There was a problem hiding this comment.
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-resolveis called heavily byjest-resolve-dependencieswhen finding related tests. Benchmarking the simple change fromObjecttoMapfor the internal cache shows an 18% improvement in the total run time ofdependencyResolver.resolveInversefor 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