Comparing these two commands building Cargo itself with lto='thin':
cargo build --release
cargo build --release --bin cargo
The first command does not engage the LTO codegen optimization added in #8192. On my system, the total build time goes from 187s to 150s.
It is a bit surprising, since the two commands generally produce the same output, so I would not expect them to use different settings.
Would it make sense to be a little smarter about how the root units are chosen? I think the crux of the issue is this line where it starts the lib at Lto::None in the first case. In the second case, it is computed as a dependency with Lto::OnlyBitcode.
Comparing these two commands building Cargo itself with
lto='thin':cargo build --releasecargo build --release --bin cargoThe first command does not engage the LTO codegen optimization added in #8192. On my system, the total build time goes from 187s to 150s.
It is a bit surprising, since the two commands generally produce the same output, so I would not expect them to use different settings.
Would it make sense to be a little smarter about how the root units are chosen? I think the crux of the issue is this line where it starts the lib at
Lto::Nonein the first case. In the second case, it is computed as a dependency withLto::OnlyBitcode.