Skip to content

Commit 3286300

Browse files
haskellPackages: build with RTS -A64M options
Those flags were not actually passed to GHC before, but to Setup.hs. They were introduced in #86948. The related twitch live stream uses the build of git-annex as a measurement. I get the following numbers when building git-annex with doCheck = false: - for current master: 1:40 wall clock / 340s user - without any -A64M argument: 1:40 wall clock / 340s user - with this fix: 1:13 wall clock / 280s user The idea was good, but the settings were never active. More testing revealed that this seems to work on darwin just as well, so we're removing the isLinux condition, too.
1 parent fb51693 commit 3286300

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

pkgs/development/haskell-modules/generic-builder.nix

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ let
235235
] ++ optional (allPkgconfigDepends != [])
236236
"--with-pkg-config=${pkg-config.targetPrefix}pkg-config";
237237

238-
parallelBuildingFlags = "-j$NIX_BUILD_CORES" + optionalString stdenv.isLinux " +RTS -A64M -RTS";
238+
makeGhcOptions = opts: lib.concatStringsSep " " (map (opt: "--ghc-option=${opt}") opts);
239239

240240
crossCabalFlagsString =
241241
lib.optionalString isCross (" " + lib.concatStringsSep " " crossCabalFlags);
@@ -256,8 +256,8 @@ let
256256
"--package-db=$packageConfDir"
257257
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/${ghcLibdir}/${pname}-${version}")
258258
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
259-
(optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
260-
(optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
259+
(optionalString enableParallelBuilding (makeGhcOptions [ "-j$NIX_BUILD_CORES" "+RTS" "-A64M" "-RTS" ]))
260+
(optionalString useCpphs ("--with-cpphs=${cpphs}/bin/cpphs " + (makeGhcOptions [ "-cpp" "-pgmP${cpphs}/bin/cpphs" "-optP--cpp" ])))
261261
(enableFeature enableLibraryProfiling "library-profiling")
262262
(optionalString (enableExecutableProfiling || enableLibraryProfiling) "--profiling-detail=${profilingDetail}")
263263
(enableFeature enableExecutableProfiling "profiling")
@@ -280,16 +280,14 @@ let
280280
) ++ optionals enableSeparateBinOutput [
281281
"--bindir=${binDir}"
282282
] ++ optionals (doHaddockInterfaces && isLibrary) [
283-
"--ghc-options=-haddock"
283+
"--ghc-option=-haddock"
284284
];
285285

286286
postPhases = optional doInstallIntermediates "installIntermediatesPhase";
287287

288288
setupCompileFlags = [
289289
(optionalString (!coreSetup) "-package-db=$setupPackageConfDir")
290-
(optionalString enableParallelBuilding parallelBuildingFlags)
291290
"-threaded" # https://github.com/haskell/cabal/issues/2398
292-
"-rtsopts" # allow us to pass RTS flags to the generated Setup executable
293291
];
294292

295293
isHaskellPkg = x: x ? isHaskellLibrary;

0 commit comments

Comments
 (0)