[GHC] #10069: CPR related performance issue

GHC ghc-devs at haskell.org
Tue Feb 10 09:39:08 UTC 2015


#10069: CPR related performance issue
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1-rc2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Thanks for the `-ddump-simpl` output.  I can see what is happening.

 The trouble is that `a1`, `a2` etc are marked `NOINLINE`, but their
 strictness information is still visible.  That makes `fa` strict too.  So
 the original code looks like this (I have decreased the number of
 selectors to make it easy to read):
 {{{
 --------- Before strictness analysis -------------
 fa a = case a1 a of I# i1 ->
        case a2 a of I# i2 ->
        I# (i1 +# i2)

 --------- After strictness analysis and worker/wrapper -------------
 fa a = case a of A _ _ _ _ i1 _ _ _ _ i2 _ _ _ _ ->
        $wfa i1 i2

 $wfa i1 i2
   = let a = A bot bot bot bot i1 bot bot bot bot i2 bot bot bot bot
     in case a1 a of I# i1 ->
        case a2 a of I# i2 ->
        I# (i1 +# i2)
 }}}
 The worker `$wfa` would normally collapse into nice tight code, when the
 workers for `a1` and `a2` are inlined. But here they are not!  So `$wfa`
 does reboxing which is terrible.

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


More information about the ghc-tickets mailing list