-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add precompiles & disable constprop #43367
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
These are targeted at reducing Revise latency if callbacks run synchronously.
This shaves about 100ms off the time to load Images.jl under Revise.
But the main purpose of constant prop' is to shape up the method body by eliminating unreachable blocks using constant information, which might then be successfully inlined into the caller context, and in this sense a boolean flag argument often leads to successful constant prop'. But yes, we may be able to come up with better heuristics by inspecting those functions and figuring out the patterns that leads to unexpected recompilations. |
|
Agreed that it serves a purpose, or this would have been a PR to disable const-prop for keyword arguments of body-functions. And I am not sure it's an easy problem to figure out which ones are useful and which ones are not. Yet it's amazing how often it crops up for this specific case. |
|
In case people are skeptical, maybe it's helpful to share an example. Working with @quinnj, we identified const-prop as the reason for recompilation of https://github.com/JuliaData/CSV.jl/blob/1586ea1a57a168005420dafab9f3686c6cbd3ff5/src/file.jl#L224-L339. It's pretty insane that this method gets const-propped on |
|
Could |
|
Agreed, but the main point is that the heuristic for deciding whether to const-prop is not very well-aligned with what a human would likely decide: as an example in this PR, should While I've seen lots of examples that are just crazy, I haven't even begun to think about whether one could improve on the existing algorithm. I'm not even sure how much my own sense of the larger context (e.g., is this part of the function performance-sensitive? how is it typically called?) is coming into play here. |
* Expand precompiles These are targeted at reducing Revise latency if callbacks run synchronously. * Disable constprop on functions that don't benefit from it This shaves about 100ms off the time to load Images.jl under Revise.
* Expand precompiles These are targeted at reducing Revise latency if callbacks run synchronously. * Disable constprop on functions that don't benefit from it This shaves about 100ms off the time to load Images.jl under Revise.
This PR shaves about 100ms off the time to load packages with Revise running. (Testcase was Images.jl, which has lots of dependencies and also uses
@requireblocks.) The most important change is to eliminate constant-propagation for a number of methods that clearly shouldn't be specialized on particular constants. As identified in #38983, boolean keyword arguments are a particularly-frequent source of trouble. We may want to take a closer look at our heuristics, but in the meantime this seems reasonable to me.This claws back much of the time lost due to timholy/Revise.jl#657.