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

GHC ghc-devs at haskell.org
Thu Mar 29 18:49:23 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 George):

 Your example seems to be different than mine in that when I compile yours
 with ghc 8.4.1 and -O there is no difference in allocation unlike mine.
 What flags did you compile with?

 {{{
  ghc -O repro.hs +RTS
 [1 of 1] Compiling Main             ( repro.hs, repro.o )
 Linking repro ...
 bash-3.2$ ./repro 1 +RTS -s
 ()
           56,880 bytes allocated in the heap
            3,480 bytes copied during GC
           44,576 bytes maximum residency (1 sample(s))
           25,056 bytes maximum slop
                2 MB total memory in use (0 MB lost due to fragmentation)

                                      Tot time (elapsed)  Avg pause  Max
 pause
   Gen  0         0 colls,     0 par    0.000s   0.000s     0.0000s
 0.0000s
   Gen  1         1 colls,     0 par    0.000s   0.000s     0.0002s
 0.0002s

   INIT    time    0.000s  (  0.002s elapsed)
   MUT     time    0.051s  (  0.052s elapsed)
   GC      time    0.000s  (  0.000s elapsed)
   EXIT    time    0.000s  (  0.003s elapsed)
   Total   time    0.051s  (  0.057s elapsed)

   %GC     time       0.3%  (0.4% elapsed)

   Alloc rate    1,118,716 bytes per MUT second

   Productivity  99.3% of total user, 95.6% of total elapsed

 bash-3.2$ ./repro 2 +RTS -s
 ()
           56,880 bytes allocated in the heap
            3,480 bytes copied during GC
           44,576 bytes maximum residency (1 sample(s))
           25,056 bytes maximum slop
                2 MB total memory in use (0 MB lost due to fragmentation)

                                      Tot time (elapsed)  Avg pause  Max
 pause
   Gen  0         0 colls,     0 par    0.000s   0.000s     0.0000s
 0.0000s
   Gen  1         1 colls,     0 par    0.000s   0.000s     0.0002s
 0.0002s

   INIT    time    0.000s  (  0.002s elapsed)
   MUT     time    0.051s  (  0.051s elapsed)
   GC      time    0.000s  (  0.000s elapsed)
   EXIT    time    0.000s  (  0.005s elapsed)
   Total   time    0.051s  (  0.059s elapsed)

   %GC     time       0.3%  (0.3% elapsed)

   Alloc rate    1,120,655 bytes per MUT second

   Productivity  99.3% of total user, 95.7% of total elapsed
 }}}

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


More information about the ghc-tickets mailing list