[Haskell-beginners] GHC-generated executables size

Daniel Fischer daniel.is.fischer at web.de
Sun Oct 17 07:58:48 EDT 2010


On Sunday 17 October 2010 13:10:32, . wrote:
> Ok, after recompiling gtk again and hiding gtk-0.11.0 (which was still
> monolithic), it worked.

Good.

> The executable is now, after stripping, a mere
> 2.7MB in size (which is still large for what it does, but much better).

Well, the executable contains the runtime, so it's naturally much larger 
than a small C programme. Compare with

$ cat helloWorld.hs
module Main (main) where

main :: IO ()
main = putStrLn "Hello, World!"
$ ghc --make helloWorld.hs
[1 of 1] Compiling Main             ( helloWorld.hs, helloWorld.o )
Linking helloWorld ...
$ ls -l helloWorld
-rwxr-xr-x 1 dafis users 618581 17. Okt 13:53 helloWorld

I suppose on a 64-bit system, you get about twice the numbers, so 2.7MB for 
a programme using gtk isn't exorbitant.

> Thanks to all who answered for your help!
>
> Christian

Cheers,
Daniel



More information about the Beginners mailing list