Skip to content

Speed up compilation by 23% #49

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

Merged
merged 1 commit into from
Jun 3, 2025
Merged

Conversation

Enselic
Copy link
Member

@Enselic Enselic commented Jun 3, 2025

Before this commit, serde_derive is built before serde. But serde does not depend on serde_derive, so that is not needed. Instead, build serde and serde_derive in parallel. That speeds up compilation by 23%.

Before:

$ hyperfine --prepare 'cargo clean' 'cargo build'
Benchmark 1: cargo build
  Time (mean ± σ):      4.979 s ±  0.044 s    [User: 4.887 s, System: 0.714 s]
  Range (min … max):    4.915 s …  5.068 s    10 runs

After:

$ hyperfine --prepare 'cargo clean' 'cargo build'
Benchmark 1: cargo build
  Time (mean ± σ):      3.821 s ±  0.065 s    [User: 5.083 s, System: 0.740 s]
  Range (min … max):    3.749 s …  3.955 s    10 runs

Before this commit, serde_derive is built before serde. But serde does
not depend on serde_derive, so that is not needed. Instead, build serde
and serde_derive in parallel. That speeds up compilation by 23%.

Before:

    $ hyperfine --prepare 'cargo clean' 'cargo build'
    Benchmark 1: cargo build
      Time (mean ± σ):      4.979 s ±  0.044 s    [User: 4.887 s, System: 0.714 s]
      Range (min … max):    4.915 s …  5.068 s    10 runs

After:

    $ hyperfine --prepare 'cargo clean' 'cargo build'
    Benchmark 1: cargo build
      Time (mean ± σ):      3.821 s ±  0.065 s    [User: 5.083 s, System: 0.740 s]
      Range (min … max):    3.749 s …  3.955 s    10 runs
@GuillaumeGomez
Copy link
Member

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 2694972 into rust-lang:trunk Jun 3, 2025
2 checks passed
@aDotInTheVoid
Copy link
Member

aDotInTheVoid commented Jun 3, 2025

This will get blown away the next time update.sh is run. To avoid this, I'm going to submit a corresponding change to rust-lang/rust. EDIT: rust-lang/rust#141989

Also, we should use triagebot to add a comment for all PR's that touch src/ as that's almost always wrong.

@Enselic
Copy link
Member Author

Enselic commented Jun 4, 2025

Thanks. For the record, there used to be a version mismatch problem to do this split up, but that was fixed over a year ago.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 5, 2025
…umeGomez

rustdoc-json-type: Depend on `serde` and `serde_derive` seperately

Before this commit, serde_derive is built before serde. But serde does not depend on serde_derive, so that is not needed. Instead, build serde and serde_derive in parallel.

This speeds up compilation for users depending on rustdoc-json-types out of tree.

Imports: rust-lang/rustdoc-types#49

CC `@Enselic`

r? `@GuillaumeGomez`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 5, 2025
…umeGomez

rustdoc-json-type: Depend on `serde` and `serde_derive` seperately

Before this commit, serde_derive is built before serde. But serde does not depend on serde_derive, so that is not needed. Instead, build serde and serde_derive in parallel.

This speeds up compilation for users depending on rustdoc-json-types out of tree.

Imports: rust-lang/rustdoc-types#49

CC ``@Enselic``

r? ``@GuillaumeGomez``
rust-timer added a commit to rust-lang/rust that referenced this pull request Jun 5, 2025
Rollup merge of #141989 - aDotInTheVoid:sin-sooner, r=GuillaumeGomez

rustdoc-json-type: Depend on `serde` and `serde_derive` seperately

Before this commit, serde_derive is built before serde. But serde does not depend on serde_derive, so that is not needed. Instead, build serde and serde_derive in parallel.

This speeds up compilation for users depending on rustdoc-json-types out of tree.

Imports: rust-lang/rustdoc-types#49

CC ``@Enselic``

r? ``@GuillaumeGomez``
@aDotInTheVoid
Copy link
Member

Published as d7f859a (0.46.1), which also specifies that we need serde to be at least 1.0.186

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 6, 2025
rustdoc-json-type: Depend on `serde` and `serde_derive` seperately

Before this commit, serde_derive is built before serde. But serde does not depend on serde_derive, so that is not needed. Instead, build serde and serde_derive in parallel.

This speeds up compilation for users depending on rustdoc-json-types out of tree.

Imports: rust-lang/rustdoc-types#49

CC ``@Enselic``

r? ``@GuillaumeGomez``
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