Ackermann very inefficient with Haskell/GHC

后端 未结 7 914
小鲜肉
小鲜肉 2020-12-23 13:58

I try computing Ackermann(4,1) and there\'s a big difference in performance between different languages/compilers. Below are results on my

7条回答
  •  再見小時候
    2020-12-23 14:19

    It seems that there is some kind of bug involved. What GHC version are you using?

    With GHC 7, I get the same behavior as you do. The program consumes all available memory without producing any output.

    However if I compile it with GHC 6.12.1 just with ghc --make -O2 Ack.hs, it works perfectly. It computes the result in 10.8s on my computer, while plain C version takes 7.8s.

    I suggest you to report this bug on GHC web site.

提交回复
热议问题