Investigate object file sizes
If you are looking for a good standalone reproducer, see #19113 (comment 320017).
Out of curiousity, I entered hadrian's build output directory of a validate
flavoured build (so I'm not exactly sure if that's representative) and ran
find . -type f -name "*.o" | xargs du {} | sort -n
These are the top hitters:
1016 ./stage1/compiler/build/GHC/Hs/Decls.o
1024 ./stage0/compiler/build/GHC/Tc/Errors.o
1024 ./stage1/libraries/Cabal/Cabal/build/Distribution/PackageDescription/FieldGrammar.o
1024 ./stage1/utils/haddock/build/Haddock/Backends/LaTeX.o
1072 ./stage0/utils/haddock/build/Haddock/Backends/LaTeX.o
1072 ./stage1/compiler/build/GHC/Core/Lint.o
1072 ./stage1/compiler/build/GHC/StgToCmm/Prim.o
1076 ./stage0/compiler/build/GHC/Driver/Make.o
1076 ./stage1/compiler/build/GHC/CmmToAsm/X86/CodeGen.o
1136 ./stage1/libraries/ghci/build/GHCi/TH/Binary.o
1192 ./stage1/libraries/base/build/Data/Data.o
1236 ./stage1/compiler/build/GHC/Parser/Lexer.o
1272 ./stage1/libraries/Cabal/Cabal/build/Language/Haskell/Extension.o
1308 ./stage0/compiler/build/GHC/Parser/Lexer.o
1324 ./stage0/libraries/Cabal/Cabal/build/Language/Haskell/Extension.o
1348 ./stage0/compiler/build/GHC/Core/Lint.o
1364 ./stage1/compiler/build/GHC/Iface/Ext/Ast.o
1440 ./stage0/compiler/build/GHC/Iface/Ext/Ast.o
1476 ./stage1/ghc/build/GHCi/UI.o
1488 ./stage0/compiler/build/GHC/StgToCmm/Prim.o
1488 ./stage0/compiler/build/GHC/Tc/TyCl.o
1492 ./stage0/compiler/build/GHC/Tc/Module.o
1504 ./stage0/libraries/ghci/build/GHCi/TH/Binary.o
1548 ./stage1/compiler/build/GHC/Hs/Expr.o
1588 ./stage0/compiler/build/GHC/CmmToAsm/X86/CodeGen.o
1608 ./stage1/compiler/build/GHC/Platform/Constants.o
1776 ./stage0/compiler/build/GHC/Hs/Expr.o
1812 ./stage0/compiler/build/GHC/Hs/Decls.o
1824 ./stage0/libraries/Cabal/Cabal/build/Distribution/SPDX/LicenseId.o
1832 ./stage1/libraries/ghci/build/GHCi/Message.o
1880 ./stage0/compiler/build/GHC/Platform/Constants.o
1904 ./stage1/libraries/Cabal/Cabal/build/Distribution/Simple/Setup.o
1940 ./stage0/libraries/ghci/build/GHCi/Message.o
1996 ./stage1/libraries/ghc-prim/build/GHC/Types.o
2036 ./stage0/libraries/Cabal/Cabal/build/Distribution/Simple/Setup.o
2052 ./stage1/libraries/containers/containers/build/Data/Sequence/Internal.o
2064 ./stage1/compiler/build/GHC/Parser.o
2248 ./stage0/compiler/build/GHC/Parser.o
2308 ./stage1/libraries/ghc-prim/build/GHC/Classes.o
2524 ./stage1/libraries/Cabal/Cabal/build/Distribution/SPDX/LicenseId.o
2988 ./stage1/compiler/build/GHC/Builtin/PrimOps.o
3016 ./stage0/compiler/build/GHC/Driver/Session.o
3072 ./stage0/compiler/build/GHC/Builtin/PrimOps.o
3776 ./stage1/libraries/template-haskell/build/Language/Haskell/TH/Syntax.o
3816 ./stage1/compiler/build/GHC/Driver/Session.o
3916 ./stage0/libraries/template-haskell/build/Language/Haskell/TH/Syntax.o
5396 ./stage1/compiler/build/GHC/Hs/Instances.o
5864 ./stage0/compiler/build/GHC/Hs/Instances.o
These are all files taking > 1 MB. That wouldn't be too surprising if most of them made use of deriving, like Instances.o
, which is nearly 6MB in size. But some of them don't! Take GHC.Iface.Syntax
as an example. Not a single deriving clause, only very few instance
s. There are quite a few data type defs, but there's not much code.
And there aren't many ASSERT
s either, so -DDEBUG
shouldn't have much of an impact. Note how both the optimised, non-debug stage0
and the -O1
optimised, debug stage1
version of GHC.Iface.Syntax
are in that list.
We should investigate this, maybe there are some easy wins.