Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Improve compile time #90

Merged
merged 1 commit into from
Jan 31, 2020
Merged

Improve compile time #90

merged 1 commit into from
Jan 31, 2020

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Jan 31, 2020

According to measurement on my machine, compilation time go from 45.8s to 25.4s.
More infomation in cargo-timing file: https://gist.github.com/lzutao/4b1a3709d150a6c746fb9b93dcd80076

@sfackler
Copy link
Owner

Does cargo install respect this part of the manifest?

@tesuji
Copy link
Contributor Author

tesuji commented Jan 31, 2020

Test locally with cargo -Ztimings install --path ., it seems so.
I updated the gist link with new result of cargo install.

@ehuss
Copy link

ehuss commented Jan 31, 2020

You might want to consider using this instead of listing explicit packages.

[profile.release.build-override]
opt-level = 0

Also beware, this sets the msrv to 1.41.

@tesuji
Copy link
Contributor Author

tesuji commented Jan 31, 2020

this sets the msrv to 1.41.

@sfackler set CI to nightly. So this shouldn't be problem?

Does build-override make crates have build.rs (for example FFI crates) no optimization even in release build?
I cannot tell when looking at https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#overrides

@ehuss
Copy link

ehuss commented Jan 31, 2020

Does build-override make build.rs (which FFI crates often be) no optimization even in release build?

I'm not sure I understand the question. The build script and all of its dependencies will be built with opt-level=0. Running the build script will still set the OPT_LEVEL environment variable to 2, build-override does not affect that.

@tesuji
Copy link
Contributor Author

tesuji commented Jan 31, 2020

Sorry for confusing. I was asking that does build-override make FFI crates, which often have build.rs,
non opimized in release build?

@ehuss
Copy link

ehuss commented Jan 31, 2020

Ah, no. The crate itself is unaffected and will use opt-level=2. Cargo doesn't know if something is an ffi crate or not. build-override only affects compilation of the build.rs script itself (and proc macros).

@tesuji
Copy link
Contributor Author

tesuji commented Jan 31, 2020

Thanks for explanation. I was misunderstanding that.

@sfackler
Copy link
Owner

Neat, thanks!

@sfackler sfackler merged commit 082b216 into sfackler:master Jan 31, 2020
@tesuji tesuji deleted the comptime branch January 31, 2020 12:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants