You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[partitioning] Don't create CGUs below a certain size #47318
As a followup to #47316: Once we have a more accurate metric for CGU-size, we can also make sure to not sub-divide the program into smaller units than makes sense -- i.e. we don't want to have programs consisting of 16 one-function object files. We'd first have to find out concrete values for what is "too small" though. And I expect this to have little impact in practice. Consider it a mostly aesthetic improvement.
Just to re-state to make sure i understand: the intention would be to speed up bootstrap, while avoiding the test slowdown seen in #44675 (comment) by avoiding splitting to ensure multiple codegen units don't penalise many tiny compiles?
The hope would be that most test cases, which are usually small, would end up being compiled to just one codegen unit. As a result, compiling each test case would be faster because we are skipping unnecessary overhead that is introduced by splitting things into multiple CGUs.
This could be tested by making compiletest set -Ccodegen-units=1 for run-pass for example. If that makes the test suite execute faster then the optimization proposed here could be tuned to do so too.
Activity
michaelwoerister commentedon Jan 22, 2018
I have no data to back this up but this might allow to reduce our bootstrap time because it would affect most test cases? cc @rust-lang/infra
aidanhs commentedon Jan 22, 2018
Just to re-state to make sure i understand: the intention would be to speed up bootstrap, while avoiding the test slowdown seen in #44675 (comment) by avoiding splitting to ensure multiple codegen units don't penalise many tiny compiles?
michaelwoerister commentedon Jan 23, 2018
The hope would be that most test cases, which are usually small, would end up being compiled to just one codegen unit. As a result, compiling each test case would be faster because we are skipping unnecessary overhead that is introduced by splitting things into multiple CGUs.
This could be tested by making
compiletestset-Ccodegen-units=1forrun-passfor example. If that makes the test suite execute faster then the optimization proposed here could be tuned to do so too.aidanhs commentedon Jan 23, 2018
Sounds like the previous PR might be worth looking at again as low hanging fruit then, with this being a more robust solution.
Mark-Simulacrum commentedon Jan 14, 2024
This seems to have been implemented:
rust/compiler/rustc_monomorphize/src/partitioning.rs
Line 385 in 30dfb9e