
On Fri, Aug 23, 2024 at 09:22:15PM +0100, Teofil Camarasu wrote:
On my computer (and using GHC-9.8) it's a bit quicker: real 0m0.006s user 0m0.001s sys 0m0.005s
I imagine some of this time is just loading things into memory and/or running the dynamic linker.
If you are optimising for start up time, maybe fully statically linking your executable might help.
I see similarly low startup using GHC 9.8:
$ cat hw.hs
module Main(main) where
main :: IO ()
main = putStrLn "Hello World!"
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.8.2
$ ghc -O2 hw.hs
[1 of 2] Compiling Main ( hw.hs, hw.o )
[2 of 2] Linking hw
$ time ./hw
Hello World!
real 0m0.005s
user 0m0.001s
sys 0m0.004s
The corresponding C program is not dramatically faster:
$ cat hw.c
#include