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

Enable build.rs to build each source file in parallel #1591

Closed
wants to merge 15 commits into from

Conversation

NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Feb 16, 2023

This PR enables build.rs to run perl and nasm and cc in parallel to speedup compilation.
Parallel execution of perl and nasm is done manually while parallel execution of cc is done using cc::Build.

This PR also builds src and test in parallel.

required for spawning a new thread.

Signed-off-by: Jiahao XU <[email protected]>
…lism

instead of calling into `compile` and spawning one thread for each
`compile`.

Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu
Copy link
Contributor Author

NobodyXu commented Feb 16, 2023

On my powerful M1, this reduces compilation time from 4.3s => 4.2s, but on CI and other env with a much weaker CPU and much less ram, the reduction can be more significant.

I also submit a PR to cc to speedup parallel compilation, would also help ring once it is merged: rust-lang/cc-rs#780

@briansmith
Copy link
Owner

Let's split this up into multiple PRs.

parallel execution of cc is done using cc::Build.

PR #1699 will make it so that on non-Windows targets, cc::Build can build all .c and all .S files in a library in parallel, if we enable its parallel build feature.

perl

Let's do this last. Most users of ring will be building it from the crates.io release that packages the output of the PerlAsm so that perl doesn't need to be run at all.

nasm

Again, most users will be using the crates.io release where the nasm output has been prepackaged into the crate, so this isn't as urgent as the rest.

This PR also builds src and test in parallel.

I think issue #1705 describes a better solution for this.

WDYT?

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Oct 7, 2023

This PR also builds src and test in parallel.

I think issue #1705 describes a better solution for this.

WDYT?

I think #1705 is indeed a better solution.
Closing this PR.

@NobodyXu NobodyXu closed this Oct 7, 2023
@NobodyXu NobodyXu deleted the parallelism branch October 7, 2023 00:56
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.

2 participants