[Haskell-beginners] GHC-generated executables size
Gaius Hammond
gaius at gaius.org.uk
Sun Oct 17 15:14:40 EDT 2010
On 15 Oct 2010, at 21:37, Christian Gosch wrote:
> Hi,
> I was playing around with ghc again, and I was wondering what makes
> the executables so large and how I could make them smaller (strip
> works,
> but is there anything more I can do?)
> More specifically, I am compiling a program that uses the GTK+
> bindings,
> HDBC, and some things from Prelude.
> The program simply displays a window, and reads and writes values
> from/into a data base file. Not much, really.
> Anyway, the program size is 20MB without stripping, and 10MB after
> stripping ...
A Haskell program needs to schlep around a runtime with it. So when
you compare it to say a Java program, you need to compare it to the
size of a JAR + the size of the VM, and in that case the size isn't
so extraordinary. So that is the "why", as to the "what can you do"
probably not much that you've not already tried, other than supplying
your program as a script for #!/usr/bin/runghc
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/runghc.html
That would mean your program wasn't so self-contained, as the target
machine would also need to have all the "stuff" that you have compiled
in, e.g. the HDBC development package.
Cheers,
G
More information about the Beginners
mailing list