enormous executable

S.D.Mechveliani mechvel@math.botik.ru
Sat, 29 Sep 2001 14:16:04 +0400


Willem Robert van Hage <wrvh@xs4all.nl> writes

> [..]
> So I tried a simple hello world example exactly like the one
> I saw somewhere on the GHC pages that compiled to a binary of 6kb
> and I was surprised to see that even after stripping the binary
> it still takes up 140kb.
>
> -rwxr-xr-x    1 willem   users      201453 Sep 29 09:55 hello
> -rw-r--r--    1 willem   users          51 Sep 29 09:54 hello.hs
> -rw-r--r--    1 willem   users        1468 Sep 29 09:55 hello.o

It shows that source program takes         51 bytes,
              compiled object program -  1468 bytes.
This is not mauch.
Probably, the executable  hello  is 1000 times larger than object
one because some piece of  library  
(including binary code for outputting a string) 
is linked to it.  
In small user programs the library code is usually the larger 
part.
In large user programs, it will be the smaller part.

Regards,

-----------------
Serge Mechveliani
mechvel@botik.ru