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

build: customize opt-level to avoid building some crates twice #2788

Merged
merged 1 commit into from
Jun 28, 2021

Conversation

yangby-cryptape
Copy link
Collaborator

@yangby-cryptape yangby-cryptape commented Jun 25, 2021

Purpose

Since "Cargo PR-8500" merged, as "Cargo Issue-8502" said: "if a crate will also be built as a runtime dependency, that would result in Cargo building it twice, once with opt-level 0 and once with opt-level 3."

So, in this PR I customize the opt-level to the default values, to make sure each crates only be compiled once.

Results

When make prod for v0.42.0:

  • This PR can reduce the number of compiled dependencies 9.56% (596 -> 544).
  • This PR can reduce the size of target directory 14.2% (1_813_100 bytes -> 1_587_780 bytes).
  • Save total compile time.

Notice: the size of final binary won't be chaneged.

References

@quake
Copy link
Member

quake commented Jun 27, 2021

bors r=quake,driftluo

@bors
Copy link
Contributor

bors bot commented Jun 28, 2021

Build succeeded:

@bors bors bot merged commit 6844fa4 into nervosnetwork:develop Jun 28, 2021
@yangby-cryptape yangby-cryptape deleted the pr/smaller-target branch June 28, 2021 03:47
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.

3 participants