Skip to content
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

Disable optimizations for some build-time crates #2967

Merged
merged 1 commit into from Feb 1, 2020

Conversation

lnicola
Copy link
Member

@lnicola lnicola commented Jan 31, 2020

This speeds up a release build on my laptop from 4m 13s to 3m 33s. It's a bit disappointing, but we don't get perfect parallelism during the build. The non-RA dependencies finish building around 72s as opposed to 112s.

@matklad
Copy link
Member

matklad commented Feb 1, 2020

bors r+

Thanks for looking into this @lnicola !

bors bot added a commit that referenced this pull request Feb 1, 2020
2963: Emacs fixes r=matklad a=flodiebold

 - use provided environment for runnables (finally set `RUST_BACKTRACE`)
 - implement `selectAndApplySourceChange` so auto-import works 🙂 

cc @brotzeit 

2967: Disable optimizations for some build-time crates r=matklad a=lnicola

This speeds up a release build on my laptop from 4m 13s to 3m 33s. It's a bit disappointing, but we don't get perfect parallelism during the build. The non-RA dependencies finish building around 72s as opposed to 112s.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
@bors
Copy link
Contributor

bors bot commented Feb 1, 2020

Build succeeded

  • Rust (macos-latest)
  • Rust (ubuntu-latest)
  • Rust (windows-latest)
  • TypeScript

@bors bors bot merged commit f83154d into rust-lang:master Feb 1, 2020
@lnicola lnicola deleted the slower-proc-macros branch February 1, 2020 14:56
@Mark-Simulacrum
Copy link
Member

Out of interest, did we check that this doesn't slow down subsequent (incremental) builds? Or, if so, by how much?

@lnicola
Copy link
Member Author

lnicola commented Feb 3, 2020

I didn't check. Are you thinking that the proc macros got slower, or is there another reason why incremental builds should be affected?

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Feb 3, 2020

Procedural macros are evaluated on all compilations in any built crate (i.e., incremental does not apply). Depending on the relative speed up given by optimizations of those proc macro crates, this could have an impact. It would be good to check this, I think.

Edit: to be clear, incremental compilation being on or not should have no major effect on results here -- I recommend turning it off for easier measurement though.

@lnicola
Copy link
Member Author

lnicola commented Feb 3, 2020

Procedural macros are evaluated on all compilations in any built crate

Got it, thanks.

So a way to test this would be to disable incremental compilation, clean the output of every crate in rust-analyzer (I wish there was a cargo clean --no-deps), then build it again. The effect might be more noticeable on debug builds, so we could actually turn build-time crate optimizations for the dev profile instead.

@Mark-Simulacrum
Copy link
Member

Sure. My recommendation is that you probably want to have a "commonly edited file" and do something like this:

CARGO_INCREMENTAL=0 cargo build
touch path/to/normal/file.rs
CARGO_INCREMENTAL=0 cargo build # timing here is most interesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants