Skip to content

Commit

Permalink
haskellPackages: build with RTS -A64M options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wolfgangwalther committed Jun 10, 2024
1 parent fb51693 commit 3286300
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,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);
Expand All @@ -256,8 +256,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")
Expand All @@ -280,16 +280,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;
Expand Down

0 comments on commit 3286300

Please sign in to comment.