-
Notifications
You must be signed in to change notification settings - Fork 841
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
Avoid expensive version calculations during build plan construction #2062
Avoid expensive version calculations during build plan construction #2062
Conversation
=> ((PackageName -> IO (Set Version)) -> m a) | ||
-> m a | ||
withLoadPackageVersions inner = | ||
join $ runOnce $ do |
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.
Hmm, I think there's a misunderstanding here about runOnce
. join . runOnce
is essentially id
. The action returned by runOnce
lets us ask for the value. That action can be run multiple times, but the computation only gets run once (hence the name).
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.
Oh, I realized that the runOnce
wouldn't help and removed it in my second commit, but I hadn't thought that it was quite so bad!
I'll just squash my two commits and hope that the combination makes more sense.
Thanks for working on this, I think there's a bit more work to do here (see comment) |
This change delays searching the package caches for versions to the point where the versions are actually used. As the versions are only used for error messages in the case of version conflicts, this change results in a noticeable speedup for no-op builds. While this change does not remove the call to getPackageCaches as originally intended, the call should not have any performance impact as the package caches have already been loaded and cached in the withLoadPackage function that wraps constructPlan.
8cde223
to
a89cd5c
Compare
Please take a look at the squashed commit. |
Gotcha! LGTM! The main point of #1892 is about avoiding loading the cache, not about the expensive computation. This is a good change too, though, so merging |
Thanks for the review and the merge!
Do you agree with my point that the call to In that case I believe the core issue of #1892 is already resolved. |
Ah, I see where some of the confusion around I have made a change such that |
For no-op builds of the
these
package I see speedups of about 17%. For thestack
project it's only around 8%.