[GHC] #14941: Switching direct type family application to EqPred (~) prevents inlining in code using vector (10x slowdown)

GHC ghc-devs at haskell.org
Thu Jul 5 09:18:11 UTC 2018


#14941: Switching direct type family application to EqPred (~) prevents inlining in
code using vector (10x slowdown)
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      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):

 I think I see. Can you offer a small example?

 I think something like this is happening.  We have
 {{{
 ...(\(g :: Int ~ val).   ...f (d |> Num g)... ) ...

 where d :: Num Int
 }}}
 Now, we can't float that call up to the definition of `f` because it
 mentions `g`.  But we could in principle specialise `f` for `Num Int`, and
 then use that specialised version at the call.

 I'm not certain this is exactly what is happening for you.  Hence wanting
 a test case.  (You don't need to exhibit worse perf; just that a
 specialisation is created and used without the equality, but not with.)

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


More information about the ghc-tickets mailing list