Making small haskell executables?

前端 未结 7 1472
野趣味
野趣味 2020-12-12 22:12

Are there any good ways to make small haskell executables? With ghc6 a simple hello world program seems to come to about 370kB (523kB before strip). Hello world in C is abou

7条回答
  •  别那么骄傲
    2020-12-12 22:59

    GHC is statically linking everything (except libraries used by runtime itself, which are linked dynamically).

    In the old ages, GHC linked the whole (haskell) library in as soon as you've used something from it. Sometime ago, GHC started to link "per obj file", which drastically reduced the binary size. Judging from the size, you must've been using the newer GHC already.

    On the plus side, you already have a lot of stuff in those 500K, like multithreaded core, garbage collector etc.

    Add at least garbage collector to your C code, then compare them again :)

提交回复
热议问题