Skip to content

Windows: stripped executable sizes, post GHC 8.10.7

Summary

The size of stripped Windows executables increased significantly post-GHC 8.10.7 and that remains the case today. Is there a good reason why?

Steps to reproduce

With GHC 8.10.7, a 'do nothing' executable (main = pure ()) is about 1.2 million bytes after stripping:

> stack --snapshot ghc-8.10.7 ghc -- Main.hs
> stack --snapshot ghc-8.10.7 exec -- strip Main.exe
> (dir Main.exe).Length
1216000

With GHC 9.0.2 that increased by about 4.7 million bytes (389%) to about 5.9 million bytes:

> stack --snapshot ghc-9.0.2 ghc -- Main.hs
> stack --snapshot ghc-9.0.2 exec -- strip Main.exe
> (dir Main.exe).Length
5948928

and executables have stayed at about that size:

> stack --snapshot ghc-9.12.2 ghc -- Main.hs
> stack --snapshot ghc-9.12.2 exec -- strip Main.exe
> (dir Main.exe).Length
6801408

Environment

  • GHC version used: GHC 8.10.7, 9.0.2, 9.12.2

Optional:

  • Operating System: Windows 11
  • System Architecture: x86_64
Edited by Mike Pilgrem
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information