Skip to content

Large increase in binary size for Hello World in 9.4

Summary

I saw on Reddit that the size of a Hello World binary has increased from 736k to 5,5M between 8.10 and 9.4. It seems that the increase really happened between 9.2 and 9.4.

Steps to reproduce

  1. Install GHC 8.10, 9.2, and 9.4
  2. Compile a simple Hello World program with all three, as follows:
$ cat > Main.hs                                                                                                                                                                                                                                           
main = putStrLn "Hello, world!"
$ ghc-8.10 -O -o hello-8.10 Main.hs
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking hello-8.10 ...
$ ghc-9.2 -O -o hello-9.2 Main.hs
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking hello-9.2 ...
$ ghc-9.4 -O -o hello-9.4 Main.hs
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking hello-9.4
$ du -h hello-*
3,1M	hello-8.10
3,4M	hello-9.2
12M	hello-9.4
$ strip hello-*
$ du -h hello-*
740K	hello-8.10
796K	hello-9.2
5,5M	hello-9.4

Expected behavior

I would expect the size of the executable to remain unchanged.

Environment

  • GHC version used: 8.10.7, 9.2.4, and 9.4.3

Optional:

  • Operating System: Fedora 37
  • System Architecture: 64-bit Intel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information