summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-13 16:24:10 -0400
committerBen Gamari <ben@smart-cactus.org>2019-06-13 19:03:15 -0400
commit100b9ec1c3eceed01f6332aeffa5255e40024767 (patch)
tree3bce2989e6bcc30a2933de3416c106e5c4c6afdc
parent7d495356e732060922bdf9cb01fd0598f2554da9 (diff)
downloadhaskell-wip/T16817.tar.gz
Disable optimisation when building Cabal in development flavourswip/T16817
This updates the make and Hadrian build flavours targetting developers to disable optimisation when building the Cabal library. Cabal tends to tickle some very bad compiler performance cases (e.g. #16577) so disabling optimisation here makes a sizeable impact on overall build time. See #16817.
-rw-r--r--hadrian/cabal.project4
-rw-r--r--hadrian/src/Settings/Flavours/Development.hs6
-rw-r--r--mk/flavours/devel1.mk4
-rw-r--r--mk/flavours/devel2.mk4
-rw-r--r--mk/flavours/validate.mk5
5 files changed, 20 insertions, 3 deletions
diff --git a/hadrian/cabal.project b/hadrian/cabal.project
index d9c329141f..0df6b15695 100644
--- a/hadrian/cabal.project
+++ b/hadrian/cabal.project
@@ -1,8 +1,8 @@
packages: ./
../libraries/Cabal/Cabal/
-# N.B. Compile with -O0 since this is not a performance-critical executable
-# and the Cabal takes nearly twice as long to build with -O1. See #16817.
+-- N.B. Compile with -O0 since this is not a performance-critical executable
+-- and the Cabal takes nearly twice as long to build with -O1. See #16817.
package Cabal
optimization: False
diff --git a/hadrian/src/Settings/Flavours/Development.hs b/hadrian/src/Settings/Flavours/Development.hs
index 5fcc88be1e..08200dfa5a 100644
--- a/hadrian/src/Settings/Flavours/Development.hs
+++ b/hadrian/src/Settings/Flavours/Development.hs
@@ -2,6 +2,7 @@ module Settings.Flavours.Development (developmentFlavour) where
import Expression
import Flavour
+import Packages
import {-# SOURCE #-} Settings.Default
-- Please update doc/flavours.md when changing this file.
@@ -17,7 +18,10 @@ developmentArgs :: Stage -> Args
developmentArgs ghcStage = do
stage <- getStage
sourceArgs SourceArgs
- { hsDefault = pure ["-O", "-H64m"]
+ { hsDefault = mconcat [ pure ["-O", "-H64m"],
+ -- Disable optimization when building Cabal;
+ -- this saves many minutes of build time.
+ package cabal ? pure ["-O0"]]
, hsLibrary = notStage0 ? arg "-dcore-lint"
, hsCompiler = mconcat [stage0 ? arg "-O2",
succ stage == ghcStage ? pure ["-O0", "-DDEBUG"]]
diff --git a/mk/flavours/devel1.mk b/mk/flavours/devel1.mk
index e062a57909..1c03aff10b 100644
--- a/mk/flavours/devel1.mk
+++ b/mk/flavours/devel1.mk
@@ -10,3 +10,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
LAX_DEPENDENCIES = YES
+
+# Reduce optimisation when building Cabal; this makes a significant difference
+# in overall build time. See #16817.
+libraries/Cabal_dist-install_HC_OPTS += -O0
diff --git a/mk/flavours/devel2.mk b/mk/flavours/devel2.mk
index 1c8e24f745..2d7d3b3884 100644
--- a/mk/flavours/devel2.mk
+++ b/mk/flavours/devel2.mk
@@ -10,3 +10,7 @@ BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
LAX_DEPENDENCIES = YES
+
+# Reduce optimisation when building Cabal; this makes a significant difference
+# in overall build time. See #16817.
+libraries/Cabal_dist-install_HC_OPTS += -O0
diff --git a/mk/flavours/validate.mk b/mk/flavours/validate.mk
index 3fd916afb0..6395d2d62f 100644
--- a/mk/flavours/validate.mk
+++ b/mk/flavours/validate.mk
@@ -27,6 +27,10 @@ endif
WERROR = -Werror
+# Reduce optimisation when building Cabal; this makes a significant difference
+# in overall build time. See #16817.
+libraries/Cabal_dist-install_HC_OPTS += -O0
+
# DO NOT EDIT THIS FILE! Instead, create a file mk/validate.mk, whose settings
# will override these. See also mk/custom-settings.mk.
#
@@ -36,6 +40,7 @@ WERROR = -Werror
#
#
# Note [validate build settings]
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Using GhcStage2HcOpts=-O (rather than -O0) here bringes my validate down from
# 22mins to 16 mins. Compiling stage2 takes longer, but we gain a faster