Is there a simple answer: Why is GHC so big?
- OCaml: 2MB
- Python: 15MB
- SBCL: 9MB
- OpenJRE - 26MB
- GHC: 113MB
Not interested in evangelism of "Why I shouldn't care about the size if Haskell is the right tool"; this is a technical question.
Join Stack Overflow to learn, share knowledge, and build your career.
|
|
It's a bit silly really. Every library that comes with GHC is provided in no less than 4 flavours:
The GHCi version is just the static version linked together in a single Remember that GHC itself is a library, so you're getting 4 copies of GHC. Not only that, but the GHC binary itself is statically linked, so that's 5 copies of GHC. We recently made it so that GHCi could use the static |
|||||||||||||
|
|
Probably we should compare apples to apples and oranges to oranges. JRE is a runtime, not a developer kit. We may compare: source size of the development kit, the size of the compiled development kit and the compiled size of the minimal runtime. OpenJDK 7 source bundle is 82 MB (download.java.net/openjdk/jdk7) vs GHC 7 source bundle, which is 23 MB (haskell.org/ghc/download_ghc_7_0_1). GHC is not big here. Runtime size: openjdk-6-jre-headless on Ubuntu is 77 MB uncompressed vs Haskell helloworld, statically linked with its runtime, which is <1 MB. GHC is not big here. Where GHC is big, is the size of the compiled development kit:
GHC itself takes 270 MB, and with all the libraries and utilities that come together it takes over 500 MB. And yes, it's a lot, even with base libraries and a build tool/dependency manager. Java development platform is smaller. GHC:
against OpenJDK withdependencies:
But it is still more than 100 MB, not 26 MB as you write. Heavyweight things in ghc6 and ghc6-prof are:
Please note how big is |
|||||
|
|
My guess -- lots and lots of static linking. Each library needs to statically link its dependencies, which in turn need to statically link theirs and soforth. And this is all compiled often both with and without profiling, and even without profiling the binaries aren't stripped and so hold lots of debugger information. |
|||||
|
|
Because it bundles gcc and a bunch of libraries, all statically linked. At least on Windows. |
|||||||||
|
|
Short answer is that it's because all executables are statically linked, may have debug info in them and libraries are included in multiple copies. This has already been said by other commenters. Dynamic linking is possible and will reduce the size dramatically. Here is an example
I build with GHC 7.4.2 on Windows.
Running
Stripping it leaves just 13K. It's dependencies are 5 dlls with total size of 9.2 MBs unstripped and 5.7 MB stripped. |
|||
|
|
|
Here's the directory size breakdown on my box: https://spreadsheets.google.com/ccc?key=0AveoXImmNnZ6dDlQeHY2MmxPcEYzYkpweEtDSS1fUlE&hl=en It looks like the largest directory (123 MB) is the binaries for compiling the compiler itself. The documents weigh in at an astounding 65 MB. Third place is Cabal at 41 MB. The bin directory is 33 MB, and I think that only a subset of that is what's technically required to build Haskell applications. |
|||||
|