After reading https://github.com/mimblewimble/grin/issues/953 I experimented with optimization levels in grin/Cargo.toml like this:
[profile.dev]
opt-level = 1
and got these compile times for cargo clean; time cargo build
0 (20min) default. But rust functions don’t get zero-overhead here.
1 (45min) enables rust’s zero-overhead
2 (50min) “reasonable” during development even for debug=yes builds
3 (60min) --release default. “crazy optimizations, throw everything just to see what sticks”
Measurements on a MBP (2015, i5) on commit f0cf903adc and on latest master build times are similar.
Going from default (0) to 1 doubles the compile time, but crates can presumably have different opt-levels, possibly also within a workspace where dependencies are shared.
There’s also lto = true
(link time optimizations) for inlining external crates. Not recommended during development.