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

宮里洸司 viercc at gmail.com
Fri Jul 16 10:30:22 UTC 2021

I can't be sure without looking at your program directly, but
deleting all build artifacts (*.hi, *.o, the executable file, and
*.hi-boot files if there's) before compiling might resolve the issue.

What "stack ghc" does is starting GHC with appropriate configuration
(mostly which packages are to be used.) It does not recompile modules
when compilation flags were changed, just only when the source file it
depends on is changed after last compilation.
This means GHC might have compiled module A with -O0, B with -O2,
C with profiling on, etc. This mix is known to make optimizations fail

2021年7月16日(金) 18:06 Tom Ellis <tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk>:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

/* Koji Miyazato <viercc at gmail.com> */

More information about the Haskell-Cafe mailing list