-
Notifications
You must be signed in to change notification settings - Fork 110
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
Slowdown in package load times #456
Comments
I hacked together #457 to disable tracking for packages residing in
Might that be a viable solution? |
Interesting. With Revise I get julia> @time @time using LsqFit
5.202688 seconds (13.00 M allocations: 664.292 MiB, 3.53% gc time)
7.190375 seconds (22.60 M allocations: 1.113 GiB, 4.99% gc time) and without julia> @time @time using LsqFit
5.405149 seconds (9.71 M allocations: 513.312 MiB, 3.22% gc time)
5.433042 seconds (9.75 M allocations: 515.567 MiB, 3.20% gc time) So there's something to it but for me it's a much smaller effect. I'll discuss your proposed solution in #457. |
I tried setting |
Fascinating. I didn't know about this trick. Let me see if I'm interpreting this correctly: starting with the first case, My attempts to analyze why this happens have been eye-opening. The new method adds to the end of the MethodTable (position 6), whereas the method for modules is at position 4. The
So it's union-splitting! Naturally if you change the method table, anything that has been union-split (here across all 1-argument methods) is going to have to change. So the first recompilation will be fixed by annotating Obviously this is laborious. Do you know how one should decide priorities? A huge list of functions seems to be invalidated by |
I was unaware too before the trial above. It was a recommendation from @maleadt. I've been trying it out on a few packages, like trying to figure out why Flux load has got slow on MacOS. I suspect as you've found, solving each may mostly be a laborious effort by someone deep in the knowledge of a package, but easier reporting of the invalidations and dumps seems like it would be helpful. Given it requires a c code level change to activate, I'm wondering about getting some official invalidation-snooping binaries built, and setting it up as a github action to return the output as a text dump. Perhaps a more formatted report in the future |
Serious progress in JuliaLang/julia#35714... from 13 sources of invalidation to 7. But the big prize is the logging stuff and that's still not fixed. |
This is awesome. :) |
Now on Julia 1.6 the gap is much larger. Without Revise: julia> @time @time using LsqFit
1.451346 seconds (3.75 M allocations: 259.499 MiB)
1.469372 seconds (3.78 M allocations: 261.634 MiB) With Revise ( julia> @time @time using LsqFit
7.703635 seconds (15.09 M allocations: 900.068 MiB, 3.59% gc time)
7.722227 seconds (15.13 M allocations: 902.205 MiB, 3.59% gc time) Profiling shows that the difference is entirely due to Probably the best solution is to do something "cheap" initially and then do the expensive thing only if the contents of the require block get modified by the user. |
Ach.. It feels rather cruel that given the long battle you've fought and won since this issue, that it turns out to be somewhat of an edge case.. |
No worries. I'm pretty pleased about making Revise look worse when 95% of the reason is that Base got much better. Besides...on a local branch I now have julia> @time @time using LsqFit
2.235738 seconds (5.13 M allocations: 355.079 MiB, 4.50% gc time)
2.255638 seconds (5.16 M allocations: 357.196 MiB, 4.46% gc time) with Lines 400 to 405 in 850d9f2
There's really no way to do it as reliably without using the interpreter. And there's no way to use the interpreter without paying a big compile-time cost. I could scan the expression and look for Thoughts? With the imminent release of Revise 3 I can break some stuff, but this could be a regression if not managed carefully. |
Oh wait, it's worse than that...if it has any But I can scan for any |
I'm going to declare that this will be (mostly) fixed by #497. It's getting to be quite a long list of issues that closes! |
I'm seeing a strong slowdown in package load times that seems to be related to Revise being loaded.
If I do a single
@time using LsqFit
, the result of ~6 seconds actually prints in ~14 seconds.I'm illustrating this below using a
@time @time
approach, which might be flawed(?)With Revise loaded (autoloaded)
Without Revise loaded
In this case,
LsqFit
isn't a dev-ed package, so I'm wondering whether a fix to this would be to skip tracking non-dev
ed packages?Julia 1.4.0
Revise v2.6.1
cc. @MasonProtter because we were talking about it on slack
The text was updated successfully, but these errors were encountered: