Defining mapM_ in terms of traverse_ causes substantial blow-up in ByteCodeAsm
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 D1097) restores reasonable runtime.
Trac metadata
Trac field | Value |
---|---|
Version | |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |