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

GHC ghc-devs at haskell.org
Sat Apr 26 23:26:42 UTC 2014


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

Comment (by nh2):

 @nomeata

 There is an example I made for this, mentioned in the bug description.

 The performance I measure for that is:

 * using `forM_` with `ghc -O`: 2.0 s
 * using `loop ` with `ghc -O`: 1.6 s
 * using `forM_` with `ghc -O2`: 0.9 s
 * using `loop ` with `ghc -O2`: 0.3 s
 * using `forM_` with `ghc -O2 -fllvm`: 0.75 s
 * using `loop ` with `ghc -O2 -fllvm`: 0.15 s

 I tried to make an even smaller benchmark
 (https://gist.github.com/nh2/11333427) but the performance is identical
 there although the same thing changes as before.

 Could you try my two benchmarks and see if you get the same behaviour?

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


More information about the ghc-tickets mailing list