|
RE: -O causing a 7x slowdown (Map of IORef's): msg#00118lang.haskell.glasgow.bugs
On 23 April 2005 16:06, Remi Turk wrote: > the attached program is about 7 times slower when compiled > _with_ -O using ghc 6.4. Using ghc 6.2.1 with ddata's Map gives > the same behaviour. My analysis of this: the problem is the get function: get mc k= readIORef (mc ! k) in the unoptimised version, the (mc ! k) is only computed once, as it should be. The optimised version has eta-expanded this function so that (mc ! k) is evaluated once per iteration. This is because of a mis-optimisation by GHC - we try a bit too hard to optimise IO monad code, sacrificing a little performance-safety in the process. You can turn off this particular (mis-)feature with -fno-state-hack, in which case the program goes about 5 times faster. We'll take a look and see if the IO monad optimisation can be made any safer. Cheers, Simon
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: openFile "/dev/null" WriteMode fails, Simon Marlow |
|---|---|
| Next by Date: | RE: System/CPUTime.hs hsc2hs-inplace error, Simon Marlow |
| Previous by Thread: | -O causing a 7x slowdown (Map of IORef's), Remi Turk |
| Next by Thread: | [ ghc-Bugs-1188785 ] panic! ... forkM Declaration for tables{v}, SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |