-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
(Filing this issue based on discussion in the Cargo team meeting today.)
Describe the problem you are trying to solve
I like the build-time improvements provided by explicitly not optimizing build-dependencies. I'd like the ecosystem to be able to gain those improvements by default with less manual declaration.
Describe the solution you'd like
I would propose an option in the Cargo.toml
of a crate that can either say "don't bother optimizing me if I'm just a build-dependency, I probably won't benefit from it" or "please optimize me even if I'm just a build-dependency" (which would optimize it even in debug mode). The former would work well for proc-macro crates that just do a simple derive, where the time spent optimizing would never get paid off when run at build time. The latter would work well for certain types of "generator" crates like phf, where optimization is incredibly important for the performance of build-time table generation, and optimization doesn't take long.
We could then use that as the default optimization level when a crate is built as a build-dependency, with higher-level crates able to explicitly override those defaults and declare how they want their build-dependencies optimized.