[Haskell-cafe] Compiled program running (extremely) slower than interpreted equivalent (no results produced)

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Fri Jul 16 09:05:29 UTC 2021


On Fri, Jul 16, 2021 at 01:10:36AM +0000, CASANOVA Juan wrote:
> Here is my typical way to run it interpreted:
> 
>   *   stack ghci +RTS -M500m -RTS
>   *   :load CESQResolverEval.hs
>   *   main
> 
> This produces 4-5 outputs within a few seconds.
> 
> When I try to compile it:
> 
>   *   stack ghc --rts-options "-M500m" CESQResolverEval.hs
>   *   stack exec ./CESQResolverEval
> 
> This dies. Moreover, if I run without the RTS options and/or let it
> run for a while, it completely kills my computer and I have to
> restart it.

Sounds like you have a space leak.  I don't know why the space leak
would be exhibited in 'stack ghci' but not 'stack ghc'.  The first
thing I would try would be to compile with '-O0', '-O1' and '-O2' and
see if any of those make a difference (I don't know what 'stack ghc'
uses by default.).

Tom


More information about the Haskell-Cafe mailing list