Reduce optimization level while building Cabal
As noted in #16817 (closed), Cabal
contributes a great deal to our overall build times. In general we build Cabal
twice during a fresh build:
- stage0: Either while building
hadrian
orghc-cabal
, in the case of themake
build system. - stage2: The
Cabal
library that will ship with the stage2 compiler.
The performance of the stage0 build does not matter at all, so we can reduce the optimisation level freely.
The stage2 build is slightly trickier. In the interest of keeping this patch non-controversial I have opted to only reduce the optimisation level in the developer build flavours.
However, in general the only time that the Cabal
library shipped with ghc
is used is when building Setup.hs
scripts. It seems unnecessary to spend significant build time (and increased binary distribution size) by shipping an optimized Cabal
just for this.