[GHC] #11735: Optimize coercionKind

GHC ghc-devs at haskell.org
Wed Feb 7 15:34:38 UTC 2018


#11735: Optimize coercionKind
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Yes, I know changing `NthCo` caching is outstanding.

 For the `simplCast` changes: you're right -- I ignored your suggestions
 opting for something simpler. In HEAD, `pushTyCoArg` (along with friends)
 goes to some trouble to create a type-correct `Refl` coercion. But this
 coercion soon ends up being used in a cast, where `Refl`s are simply
 discarded. So all that work in building the coercion is wasted. My change
 is to return `Maybe Coercion`, preferring `Nothing` over `Just (Refl
 ...)`. This avoids the inefficient one-variable substitution that we were
 worrying about. It should be a clear win; we're doing strictly less work.
 The small complication is that there are these `Maybe`s floating about,
 but I think it's worth it. I'm hoping the comments on the `push` functions
 are clear enough, but perhaps I didn't include any information on ''why''
 `Maybe Coercion` is better than `Coercion` here.

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


More information about the ghc-tickets mailing list