Optimization defeated by merging module into main
I have a library, TheModule
, and an application that uses TheModule
, called Main
. When TheModule
lives in TheModule.hs
and Main
lives in Main.hs
, optimization works as expected. When I copy all of TheModule
's definitions and all of Main
's definitions into Both.hs
, much less optimization occurs, as can be seen from -ddump-simpl, as well as the drastic difference in running times.
The program performs a lot of small matrix-vector multiplications. The single command line argument tells how many to do.
time ./Main 1000000
20.0 :. (59.0 :. (100.0 :. (137.0 :. ())))
real 0m0.389s
user 0m0.152s
sys 0m0.232s
time ./Both 100000
20.0 :. (59.0 :. (100.0 :. (137.0 :. ())))
real 0m3.462s
user 0m3.368s
sys 0m0.068s
So that makes Both about 100 times slower. Compiled with -O2 and -fexcess-precision
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |