Build deps are unrelated to the performance or benchmarking, so they don't need to be rebuilt, and don't need to be in release mode.
Example: crate depends on rustc_version which in turn depends on semver. Semver is built in release mode for benchmarks.
I believe this is a more general issue of the release profile building build-dependencies in release mode, of which bench is one case. It's particularly annoying with things like syntex_syntax that _already_ take a long time.
I don't think there's a clear answer here of what Cargo _should_ be doing. Most build dependencies probably don't need to be optimized, but that doesn't mean that _none_ need to be optimized. It's unlikely that the optimization of the final artifacts should be related to the optimization of the build scripts
It's unlikely that the optimization of the final artifacts should be related to the optimization of the build scripts
In fact I would consider it a bug if the optimization of the final artifacts were related to the optimization of the build scripts. I agree with @bluss and @sfackler that build-dependencies never need to be optimized.
Unfortunately others actually feel the opposite, where build dependencies like lalrpop should _always_ be optimized as otherwise their execution is super slow.
This is basically what I was just thinking before, however, where I don't think there's a clear answer for what Cargo should do. There should likely be some form of configuration option at least for this, however (in one form or another)
I would love to drop 160 seconds from my release build time by letting Clippy build without optimizations. Clippy is fast enough, it's just slow to compile. And build caching is a bit flaky for me.
I've ran into this too. I use bindgen at build time, and it takes ages to compile it release mode.
An option to have separate profiles for build dependencies (similar to #1359) would be fantastic.
Most helpful comment
I don't think there's a clear answer here of what Cargo _should_ be doing. Most build dependencies probably don't need to be optimized, but that doesn't mean that _none_ need to be optimized. It's unlikely that the optimization of the final artifacts should be related to the optimization of the build scripts