#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've simplified the programs. This is what they do now:
{{{
aconit:~/current/source/sparseDomain:1821$ rm -f tests/BadPerform.o &&
ghc-6.8.2 --make tests/BadPerform.hs -ddump-simpl > badSimpl.txt && time
tests/BadPerform
[1 of 1] Compiling Main ( tests/BadPerform.hs,
tests/BadPerform.o )
Linking tests/BadPerform ...
real 0m9.585s
user 0m9.551s
sys 0m0.033s
aconit:~/current/source/sparseDomain:1822$ rm -f tests/GoodPerform.o &&
ghc-6.8.2 --make tests/GoodPerform.hs -ddump-simpl > goodSimpl.txt && time
tests/GoodPerform
[1 of 1] Compiling Main ( tests/GoodPerform.hs,
tests/GoodPerform.o )
Linking tests/GoodPerform ...
real 0m0.015s
user 0m0.012s
sys 0m0.002s
}}}
There are some fishy non-improving optimizations going on. As you
suggested, I re-complied with optimizations:
{{{
aconit:~/current/source/sparseDomain:1825$ rm -f tests/BadPerform.o &&
ghc-6.8.2 --make tests/BadPerform.hs -O -ddump-simpl > badSimplOpt.txt &&
time tests/BadPerform
[1 of 1] Compiling Main ( tests/BadPerform.hs,
tests/BadPerform.o )
Linking tests/BadPerform ...
real 0m19.101s
user 0m19.044s
sys 0m0.054s
aconit:~/current/source/sparseDomain:1826$ rm -f tests/GoodPerform.o &&
ghc-6.8.2 --make tests/GoodPerform.hs -O -ddump-simpl > goodSimplOpt.txt
&& time tests/GoodPerform
[1 of 1] Compiling Main ( tests/GoodPerform.hs,
tests/GoodPerform.o )
Linking tests/GoodPerform ...
real 0m18.974s
user 0m18.914s
sys 0m0.056s
}}}
I have also tried to radically simplify the `fixpoint` function which
would then return immediately. It is so simple, that I could build a cabal
package that doesn't link to the simplex solver and which would therefore
be easy to build for you. However, I'm not sure if you can see the
difference anymore: Repeating the good case one million times takes 0.4
seconds, repeating the bad case one million times (which does twice the
amount of work in each iteration) takes 1.4 seconds. Repeating the good
case two million times takes 0.8 seconds, as expected.
I hope the attached simplifier outputs are informative enough. Note that
I've updated the source files too!
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2252#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs