-O/-O2 causes program to run too slow

Jan Stolarek jan.stolarek at p.lodz.pl
Mon Dec 8 09:18:12 UTC 2014


While I don't know how to help with your problem I encourage you to attach your code example to 
#1168. This will certainly be helpful in working on that bug.

Janek

Dnia niedziela, 7 grudnia 2014, David Spies napisał:
> Ok, so I found that it was an instance of this:
> https://ghc.haskell.org/trac/ghc/ticket/1168
> and I read through this whole thread:
> https://www.haskell.org/pipermail/glasgow-haskell-users/2008-February/01425
>9.html
>
> I don't understand the state-hack optimization.  It's clearly not safe and
> I'm not convinced that it actually is an optimization.  In what
> circumstances does the state-hack identify a single-entry function that
> can't be identified as single-entry by some other (safe) method?
>
> On Sun, Dec 7, 2014 at 10:52 AM, David Spies <dnspies at gmail.com> wrote:
> > I have a program I wrote to submit for the Car Game problem on Kattis:
> > https://open.kattis.com/problems/cargame
> > but it runs over the 5-second time-limit
> >
> > I downloaded the test data and found that on GHC 7.8.3, if I switch from
> > -O2 to -O0, it runs three times faster (almost certainly fast enough for
> > Kattis to accept).  Can someone tell me what's going on?  Is this a bug?




More information about the ghc-devs mailing list