-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fixes resolution concurrency problem #3673
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
Conversation
That is bold :) |
That makes me think - maybe it could be interesting to have "perf regression tests", to make sure that we don't unknowingly introduce big regressions. |
Definitely a good idea to have some performance regression tracking. @trueadm, do you track performance regressions on OSS React with some framework? |
On Yoga we just run a script with some stats. Maybe we could do this kind of thing with a simple bash script? |
@arcanis, this change removes parallelism from top level resolutions, but parallelism still exists for second and deeper layer of dependencies https://github.com/yarnpkg/yarn/blob/master/src/package-request.js#L348. You'll probably want to make them in sequence as well. Can you add data to Test Plan even for the manual tests you perform? |
I've had this test for #3023 https://github.com/yarnpkg/yarn/pull/3563/files#diff-c2dc3bd2d0bdc7b8d87c36ed3039c2d4R300 |
Right!
I'd expect it too, but apparently there's little change. It even seems faster, weird observation I don't completely understand (the following numbers are obtained with a build that includes the fix inside package-request): Sync resolution (master):
Async resolution (0.24.3):
|
That looks all right when you are in corporate network, what if you are on a 3G grade network with significant latency (500ms)? I think we should do it a bit smarter and go sequential only if there is a lockfile already with all patterns resolved. |
The following numbers are from a custom build with fetching / linking disabled. We can see there's some slowdown on very slow networks (+- 4s in average, +17%), but it looks quite small, and probably insignificant compared to the time required to run the fetching + linking steps. I'd like to avoid complexifying the code by adding another parameter "is the lockfile new?", that would only be a workaround that would eventually become legacy. Ideally, I think the tree should be resolved asynchronously without any regard for any kind of context-sensitive optimizations (optimization passes being then ran on this tree), and I plan to address that in a followup PR. It should fix your concerns. WDYT? 3G sync:
3G async:
|
@bestander in regards to how we track performance regressions on React, we don't have a formal process in place yet, more an ad-hoc one. We've implemented some benchmarking tools that allow us to do this using Lighthouse: https://github.com/facebook/react/tree/master/scripts/bench |
I'll merge this PR to fix the concurrency issues that make the install unstable, and try to figure out a more secure way to improve this next week. |
@arcanis, you need to add a test too otherwise we won't notice regressions later |
Should fix #3023 for sure, possibly #3364, #3490, and #3489 as well.
Two notes:
I thought this would make perfs worse by a large factor, but actually it barely had any impact at all, even when running without lockfile. On a project requiring react-native, react, react-dom and webpack, over a hundred tries, it went from Avg:11s to Avg:12s overall.
I tried to write an integration test, but unfortunately couldn't automatically reproduce from inside the test environment get different version dependencies between before there is a yarn.lock file and after. #3023 - for some reason I always ended up getting 2.7.5 instead of the bogus 2.8.0 :( However, I was able to systematically reproduce it manually, so I'm confident that this PR should fix this issue.