[GHC] #8763: forM_ [1..N] does not get fused (10 times slower than go function)

GHC ghc-devs at haskell.org
Tue Apr 10 16:21:51 UTC 2018


#8763: forM_ [1..N] does not get fused (10 times slower than go function)
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  7.6.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7206             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by sgraf):

 I dug through `dump-simpl-iterations` and noticed that the duplication
 happens through `efdtIntFB`s unfolding, which mentions `efdtIntUpFB`
 ''and'' `efdtIntDnFB`, which both want to inline their `c` later on.

 {{{
 efdtIntFB
   = \ (@ r_a3cz)
       (c_a2ho :: Int -> r_a3cz -> r_a3cz)
       (n_a2hp :: r_a3cz)
       (x1_a2hq :: Int#)
       (x2_a2hr :: Int#)
       (y_a2hs :: Int#) ->
       case >=# x2_a2hr x1_a2hq of {
         __DEFAULT ->
           efdtIntDnFB @ r_a3cz c_a2ho n_a2hp x1_a2hq x2_a2hr y_a2hs;
         1# -> efdtIntUpFB @ r_a3cz c_a2ho n_a2hp x1_a2hq x2_a2hr y_a2hs
       }
 }}}

 I'll see what we can do about that tomorrow...

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8763#comment:58>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list