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.

(cherry picked from commit 32863001bb)
This commit is contained in:
Wolfgang Walther 2024-06-04 17:53:33 +02:00 committed by sternenseemann
parent 6f7518f116
commit cb4571f021

View File

@ -224,7 +224,7 @@ let
] ++ optional (allPkgconfigDepends != [])
"--with-pkg-config=${pkg-config.targetPrefix}pkg-config";
parallelBuildingFlags = "-j$NIX_BUILD_CORES" + optionalString stdenv.isLinux " +RTS -A64M -RTS";
makeGhcOptions = opts: lib.concatStringsSep " " (map (opt: "--ghc-option=${opt}") opts);
crossCabalFlagsString =
lib.optionalString isCross (" " + lib.concatStringsSep " " crossCabalFlags);
@ -245,8 +245,8 @@ let
"--package-db=$packageConfDir"
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/${ghcLibdir}/${pname}-${version}")
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
(optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
(optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
(optionalString enableParallelBuilding (makeGhcOptions [ "-j$NIX_BUILD_CORES" "+RTS" "-A64M" "-RTS" ]))
(optionalString useCpphs ("--with-cpphs=${cpphs}/bin/cpphs " + (makeGhcOptions [ "-cpp" "-pgmP${cpphs}/bin/cpphs" "-optP--cpp" ])))
(enableFeature enableLibraryProfiling "library-profiling")
(optionalString (enableExecutableProfiling || enableLibraryProfiling) "--profiling-detail=${profilingDetail}")
(enableFeature enableExecutableProfiling "profiling")
@ -269,16 +269,14 @@ let
) ++ optionals enableSeparateBinOutput [
"--bindir=${binDir}"
] ++ optionals (doHaddockInterfaces && isLibrary) [
"--ghc-options=-haddock"
"--ghc-option=-haddock"
];
postPhases = optional doInstallIntermediates "installIntermediatesPhase";
setupCompileFlags = [
(optionalString (!coreSetup) "-package-db=$setupPackageConfDir")
(optionalString enableParallelBuilding parallelBuildingFlags)
"-threaded" # https://github.com/haskell/cabal/issues/2398
"-rtsopts" # allow us to pass RTS flags to the generated Setup executable
];
isHaskellPkg = x: x ? isHaskellLibrary;