[GHC] #13692: Constructors and such should be able to move around seq# sometimes

GHC ghc-devs at haskell.org
Mon May 15 16:23:06 UTC 2017


#13692: Constructors and such should be able to move around seq# sometimes
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.2.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 Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Good point.  Is it a performance-critical point?  Or just an observation.

 `seq#` seems poorly documented in GHC's source code.  It should really be
 called `evaluate#` for a start.  I think it's important that it is ''not''
 strict because I think the idea is that no earlier code should evaluate
 its argument.

 I guess this transformation would be sound
 {{{
    seq (case e of p -> r) s
 -->
    seq e s of (# s', v #) ->
    case v of p ->
    seq r s'
 }}}
 which I think is more or less what you are suggesting.  I have no idea if
 it'd be worth it; but I suppose it could be if it removed allocation from
 some inner loop.

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


More information about the ghc-tickets mailing list