Closed
Description
I noticed my project https://github.com/matthiaskrgr/cargo-cache took noticeably longer to build with "lto=true" at some point.
I benchmarked link time (touch src/main.rs; cargo build --release) which appear to blow up as soon as we have several codegen units.
link times:
release | stable: 1.23 | beta: 1.24 | nightly: 1.25 |
---|---|---|---|
profile.release, lto=true, codegen-units=1 | 45s | 65s | 48s |
profile.release, lto=true | 46s | 278s | 244s |
profile.release (default) | 6.3s | 6.39 | 6.43s |
So it seem codegen-units=1 makes for bad parallelism while building but speeds up lto because less translation units need to be merged.
Maybe it is possible to dynamically use as little codegen units as possible (but still enough to utilize all cores) when building? //cc #46910