[GHC] #10711: Defining mapM_ in terms of traverse_ causes substantial blow-up in ByteCodeAsm
GHC
ghc-devs at haskell.org
Thu Jul 30 12:42:54 UTC 2015
#10711: Defining mapM_ in terms of traverse_ causes substantial blow-up in
ByteCodeAsm
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner: bgamari
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version:
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Compile-time
Unknown/Multiple | performance bug
Test Case: ghcirun004 | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
Phab:D924 has proposed that we redefine `mapM_`, currently,
{{{
mapM_ = foldr ((>>) . f) (return ())
}}}
as,
{{{
mapM_ = foldr ((*>) . f) (return ()) = traverse_
}}}
as part of the AMP proposal.
However, this appears to have severe effects on the performance
characteristics of the `Assembler` monad defined in `ByteCodeAsm`. In
particular, the `mapM_` use in `ByteCodeAsm.assembleBCO` blows up
severely, increasing the runtime of the `ghcirun004` testcase from 4
seconds to over 5 minutes.
Intriguingly, defining `(*>) = (>>)` in `Assembler`'s `Applicative`
instance (as done in Phab:D1097) restores reasonable runtime.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10711>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list