#5113: Huge performance regression of 7.0.2, 7.0.3 and HEAD over 7.0.1 and 6.12
(MonoLocalBinds)
----------------------------------+-----------------------------------------
Reporter: daniel.is.fischer | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.3 | Keywords: performance, MonoLocalBinds
Testcase: | Blockedby:
Os: Linux | Blocking:
Architecture: x86 | Failure: Runtime performance bug
----------------------------------+-----------------------------------------
Comment(by daniel.is.fischer):
Namely, the culprit is
{{{
inc i = unsafeRead darr i >>= \k -> unsafeWrite darr i (k+1)
}}}
`darr` is an `STUArray s Int Int`, yet without MonoLocalBinds or a type
signature, 7.0.3 produces
{{{
let {
$winc_s21z
:: forall (m_a1mK :: * -> *).
GHC.Base.Monad m_a1mK =>
(forall i_a1my.
GHC.Arr.Ix i_a1my =>
Data.Array.Base.STUArray
s_a1ln i_a1my GHC.Types.Int
-> GHC.Types.Int
-> m_a1mK GHC.Types.Int)
-> (forall i_a1mk.
GHC.Arr.Ix i_a1mk =>
Data.Array.Base.STUArray
s_a1ln i_a1mk GHC.Types.Int
-> GHC.Types.Int
-> GHC.Types.Int
-> m_a1mK ())
-> GHC.Types.Int
-> m_a1mK ()
[LclId, Arity=4, Str=DmdType SLLL]
$winc_s21z =
\ (@ m_a1mK::* -> *)
(ww3_s1YM :: GHC.Base.Monad m_a1mK)
(ww4_s1YS
:: forall i_a1my.
GHC.Arr.Ix i_a1my =>
Data.Array.Base.STUArray
s_a1ln i_a1my GHC.Types.Int
-> GHC.Types.Int
-> m_a1mK GHC.Types.Int)
(ww5_s1YT
:: forall i_a1mk.
GHC.Arr.Ix i_a1mk =>
Data.Array.Base.STUArray
s_a1ln i_a1mk GHC.Types.Int
-> GHC.Types.Int
-> GHC.Types.Int
-> m_a1mK ())
(w1_s1YV :: GHC.Types.Int) ->
GHC.Base.>>=
@ m_a1mK
ww3_s1YM
@ GHC.Types.Int
@ ()
(ww4_s1YS
@ GHC.Types.Int
GHC.Arr.$fIxInt
marr_s21x
w1_s1YV)
(\ (k_a169 :: GHC.Types.Int) ->
ww5_s1YT
@ GHC.Types.Int
GHC.Arr.$fIxInt
marr_s21x
w1_s1YV
(case k_a169 of _ { GHC.Types.I# x1_X1G6 ->
GHC.Types.I# (GHC.Prim.+# x1_X1G6 1)
})) }
}}}
Give that a type signature `inc :: Int -> ST s ()` (requires moving stuff
outside the `runST`) and you're good again.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5113#comment:1>
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