-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Hydrate virtual packages #990
Conversation
Ok I think I got the virtual-state.yml file content right, it looks like this:
|
Now I need to know what to do of it aha |
I looked into it since I was sure my instructions were missing a few pieces that could be a bit complex - I published my findings here: crubier#2 Basically, the main changes have been that:
|
823ed37
to
d656142
Compare
Fixes the serialization / hydratation
Nice @arcanis ! It is looking good:
However, about the
Basically the problem is that the current solution (with Maybe the stress test is a bit too harsh though, I admit. But still, it is a monorepo of 200 packages where some have 100 dependencies. These numbers are high but not astronomical, but the resolution time takes a sharp turn up at some point. I guess we could argue that a 40s But the main point which is the big win here is that the time to run |
Here is the curve of install time (vertical, in seconds) vs package number in the stress test (horizontal) We can see
There is a 5th layer in the stress test... Can't wait to see the curve 😱 Edit: Same curve with logarithmic scale, to better see the first layers. |
To be clear, I didn't expect this PR to improve the install time. The install time explosion is caused by the late deduping inside
That's interesting, I actually would expect it to be very slightly slower (the time needed to generate the virtual state file). Hm 🤔 |
You’re right, I think the impact on install time I perceived was just wishful thinking on my part as the early stage of the stress test are fast. |
This indeed solves the run duration on the stress test repo, it now takes 0.26s instead of 25s 🎉 On our private repo, it took the time down from 200s to 7s. So this is much better and definitely worth it. But this is actually still too slow as compared to yarn v1 ... yarn v1 was pretty much instant for this, but with v2 we have a 7s lag before each command. For example, when running a general build of our 200 packages, we now waste 1400 seconds just on the hydrate... Another example, the format on save of VSCode on our repo was instant and painless, but now saving a file takes like 8 seconds... Our I noted that in some commands, that resolution is done twice (like one for the I think we need even more optimisations like this... For example, does the |
Is there a way to easily identify the "culprit" packages that generate a lot of virtual packages? As I said our |
🤔 Technically if we can serialize / restore Maybe using the "canonical way" to restore the virtual links (going through the resolvers, then updating the dependencies as a postprocess pass) was a red herring and we should instead turn
That's what it does, but in a lossy format tailored to the PnP implementation which doesn't contain all the information Yarn needs (for example Yarn needs to keep track of the package checksums, but the PnP loader doesn't care about that). |
I will try this in a new branch. It will look similar except that the content and name of the file will be different |
@crubier Hi, could you put somewhere the big project from your experiments into GitHub? I'm trying to understand can we reduce size of |
@larixer Sure, it is there on my colleagues @etiennedupont repo here : https://github.com/etiennedupont/yarn-v2-stress-test |
@crubier Awesome, thank you! |
What's the problem this PR addresses?
#973
How did you fix it?
Following #973 (comment)