-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Experiment with reusing monomorphized instances across crates #1980
Comments
Yeah, this is worth doing. It'd also plausibly be worth pre-specializing a variety of generics in libstd and libcore and such. Maybe some kind of |
Cleared assignee. |
@graydon: I think being able to pre-specialize is a good solution. C++11 supports this by letting you declare template instantiations as |
LLVM supports this with |
Also see #9222 (though that doesn't solve the cross-crate issue). |
P-low, not 1.0 |
Visiting for triage. Hasn't been done yet. |
Triage: no updates |
cc @brson, do you feel your work in this area is enough to close this? It sounded like experiments were done, conclusions were reached, and we probably don't want to land it in the compiler at this time? Plus you get to close a pre-2k bug :) |
After a few weeks of on-and-off work I could not find a simple heuristic that would produce reliable wins. Switching large amounts of functions from internal to some form of external linkage causes the compilation profile to change in large but subtle ways, and I couldn't find a scenario where the changes were consistently in favor of better compile times. I haven't given up hope though. I think this technique still has clear applications to profile-based (de)optimization and pre-instantiation of std library functions. I do think it's not worth keeping this open. If somebody has a breakthrough someday it'll happen. If not, nbd. |
My big headline number for this effort was that I reduced total servo debug build times by 8%. The tradeoff though was that some crates took significantly longer to build, punishing smaller projects. |
Currently, crates generate their own versions of all generic functions they use. They could write info about the generated functions to the metadata, and crates compiling against them could check that first, and simply link the already existing instance when possible. This is bound to reduce code output size, and thus compilation time.
The text was updated successfully, but these errors were encountered: