Uh oh!
There was an error while loading. Please reload this page.
Skip MIR encoding for cargo check - #49433
Conversation
leonardo-m
commented
Mar 27, 2018
I think this also works if you use "rustc --emit=metadata" (and you aren't using Cargo). |
varkor
commented
Mar 27, 2018
Yes, this is exactly what |
| fn metadata_output_only(&self) -> bool { | ||
| // MIR optimisation can be skipped when we're just interested in the metadata. | ||
| self.tcx.sess.opts.output_types.keys().count() == 1 && |
There was a problem hiding this comment.
Please add a len() impl to OutputTypes in https://github.com/rust-lang/rust/blob/master/src/librustc/session/config.rs and call that instead of the keys(). count().
This solution is debatable. Basically, it should be possible to reconstruct something resembling a final linked result from component received from |
shepmaster
commented
Mar 30, 2018
r? @nagisa |
I think the solution is fine. We don't specify that Let's see how much of a difference this even makes: |
bors
commented
Apr 3, 2018
Skip MIR optimisation for cargo check Resolves#48662. r? @michaelwoerister
michaelwoerister
commented
Apr 3, 2018
After chatting a bit on IRC, @nagisa and I came to the conclusion that it would be better (i.e. more future-proof) to use |
bors
commented
Apr 3, 2018
💥 Test timed out |
michaelwoerister
commented
Apr 3, 2018
@bors try |
michaelwoerister
commented
Apr 3, 2018
Maybe we should discuss this in @rust-lang/compiler meeting. The PR, as implemented here does not really pose a regression to what one can do with |
michaelwoerister
commented
Apr 3, 2018
@Mark-Simulacrum, something has gone wrong with the try-build. Could you restart it? I want to get some perf numbers in order to find out if the speedups are even worth the fuss |
| } | ||
| pub fn len(&self) -> usize { | ||
| self.0.keys().count() |
There was a problem hiding this comment.
Doesn't BTreeMap have a len method?
So a mir-opt-level based solution would end up looking like this for almost every MIR pass. A number of passes here are all a good target for having their AFAIR currently It might make sense to stabilise this option to some degree and also review which passes are run at what levels. |
eddyb
commented
Apr 4, 2018
I don't understand why we need to touch anything about optimizations, instead of the current status of the PR which skips encoding? I expect serializing MIR to potentially be costlier than doing most of the enabled-by-default optimizations. |
nagisa
commented
Apr 4, 2018
Oh, that is a fair point, and I had completely missed that, due to how trivial the PR looked and how misleading the title was. I guess this approach works for me then provided we figure out what exactly would make sure that we still end up querying the "analysed" MIR for everything, so that MIR borrowck and friends are still executed. cc @nikomatsakis what ensures that "analysed" MIR is queried if "optimised" MIR is not? |
308f381 to
8414520CompareWith the current commits, is MIR emitting suppressed, or is it still emitted unoptimised? It looks like you have changed the title, but I'm not sure if the patch reflects it. Edit: looks like disabling MIR inlining also suppress MIR encoding. Also, I'd prefer having this as a flag, similar to what @nagisa said. I have #44587 in mind, and we should not diverge rmeta from what is embedded inside the rlib. |
| fn metadata_output_only(&self) -> bool { | ||
| // MIR optimisation can be skipped when we're just interested in the metadata. | ||
| self.tcx.sess.opts.output_types.len() == 1 && |
There was a problem hiding this comment.
Cargo also includes dep-info as output; we probably need to check if we have anything any output that requires codegen.
There was a problem hiding this comment.
Good catch! This method could be implemented as
fnmetadata_output_only(&self) -> bool{// MIR optimisation can be skipped when we're just interested in the metadata.
!self.tcx.sess.opts.output_types.should_trans()}005d032 to
5576ce8Compareishitatsuyuki
commented
Apr 10, 2018
How much does this speed up |
michaelwoerister
commented
Apr 10, 2018
@bors try |
bors
commented
Apr 10, 2018
Skip MIR encoding for cargo check Resolves#48662. r? @michaelwoerister
michaelwoerister
commented
Apr 10, 2018
@ishitatsuyuki Let's take a look. |
bors
commented
Apr 10, 2018
☀️ Test successful - status-travis |
ishitatsuyuki
commented
Apr 10, 2018
@Mark-Simulacrum Can you please start a perf run? |
Mark-Simulacrum
commented
Apr 11, 2018
Perf started. |
ishitatsuyuki
commented
Apr 12, 2018
Up to 10% faster on check, others are noise. |
ishitatsuyuki
commented
Apr 15, 2018
I think we can merge this. Any concerns? @nagisa@michaelwoerister |
michaelwoerister
commented
Apr 16, 2018
bors
commented
Apr 16, 2018
📌 Commit 5576ce8 has been approved by |
bors
commented
Apr 16, 2018
Skip MIR encoding for cargo check Resolves#48662. r? @michaelwoerister
bors
commented
Apr 16, 2018
☀️ Test successful - status-appveyor, status-travis |
Resolves#48662.
r? @michaelwoerister