Extreme performance degradation on minor code change
The attached code runs two similar calculations (call them a and b) 1000 times. If I calculate a and then b and then do the same 1000 times again the code runs in:
time ./tests/BadPerform
real 0m40.429s
user 0m40.360s
sys 0m0.054s
If I run a 1000 times, then b 1000 times, the code runs in:
time ./tests/GoodPerform
real 0m0.083s
user 0m0.081s
sys 0m0.001s
These are the times for ghc 6.6.1. For ghc 6.8.2, the first time reduces to 34s and the second time is identical.
Reproducing this bug is a bit involved: My program links to glpk which in turn uses gmp. Thus, you would have to:
-
install GLPK somewhere
-
extract the attached
sparsePolyhedra-0.1.0
cabal package -
create a local copy of
libgmp
andlibglpk
in which all symbols containing gmp are renamed to mygmp*
cd
tosparsePolyhedra-0.1.0
* in
genLibs.sh
change the paths containing/users/absint/simona/local/lib
to where you installed GMP and GLPK* run
genLibs.sh
which will create local copies of -
in
sparsePolyhedra.cabal
change the path/users/absint/simona/current/source/sparseDomain
to the current directory -
build and register the cabal package
-
compile the attached
BadPerform.hs
andGoodPerform.hs
I guess this is quite complicated. I could send you the IM Core of these two files instead, if that helps.
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |