#2252: Extreme performance degradation on minor code change
----------------------+-----------------------------------------------------
 Reporter:  simona    |          Owner:                
     Type:  bug       |         Status:  new           
 Priority:  normal    |      Milestone:                
Component:  Compiler  |        Version:  6.8.2         
 Severity:  normal    |     Resolution:                
 Keywords:            |     Difficulty:  Unknown       
 Testcase:            |   Architecture:  x86_64 (amd64)
       Os:  Linux     |  
----------------------+-----------------------------------------------------
Comment (by simona):

 I think (and hope) that BadPerform is going bizarrely slow. BadPerform
 runs the same loop twice and should thus only be twice as slow as
 GoodPerform, not 800 times as slow. I ran more complex examples a million
 times and got something in the range of 4-8s which means that each
 fixpoint computation (involving 8 iterations around the loop) takes 4-8us
 which is actually quite fast since that would mean that some complicated
 list operations and a several calls to simplex are done in a few thousand
 instructions on this 2.X GHz machine. But the numbers did seem to make
 sense in relation to each other.

 I tried to add the `-fno-state-hack` flag but that didn't change anything.

 I copied stubs of the relevant function into a new module called `Fake.hs`
 -- I tried putting the functions directly into `BadPerform.hs` but that it
 went as fast as `GoodPerform.hs`. I made the `fixpoint` function go slower
 by adding the test `minimum [i+j | i <- [1..100], j <- [1..100]]<3` as you
 suggested.

 The results:
 {{{
 1858$ rm -f tests/GoodPerform.o && ghc-6.8.2 --make GoodPerform.hs && time
 GoodPerform
 real    0m0.008s
 user    0m0.004s
 sys     0m0.004s
 1859$ rm -f tests/BadPerform.o && ghc-6.8.2 --make BadPerform.hs && time
 BadPerform
 Linking BadPerform ...

 real    0m2.923s
 user    0m2.911s
 sys     0m0.010s
 }}}

 I will update the two source files and their simplifier dump. I'll also
 add `Fake.hs`.

 Thanks for looking into this.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2252#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to