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

Optimize cc::Build::try_compile: Reuse PrintThread #817

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Optimize cc::Build::try_compile: Reuse PrintThread #817

merged 1 commit into from
Jul 20, 2023

Conversation

NobodyXu
Copy link
Collaborator

@NobodyXu NobodyXu commented Jul 10, 2023

Creating a new thread is very expensive, this commit optimizes calls to cc::Build::assemble, cc::Build::assemble_progressive and cc::Build::compile_objects to avoid repeated creation, destruction and joining on threads.

It also eliminates a few unnecessary heap allocation.

Creating a new thread is very expensive, this commit optimizes calls to
`cc::Build::assemble`, `cc::Build::assemble_progressive` and
`cc::Build::compile_objects` to avoid repeated creation, destruction and
joining on threads.

It also eliminates a few unnecessary heap allocation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new thread is not that expensive, but this patch is not unreasonable either.

@thomcc thomcc merged commit d616c2e into rust-lang:main Jul 20, 2023
16 checks passed
@NobodyXu NobodyXu deleted the optimize branch July 20, 2023 06:25
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

2 participants