[GHC] #14790: eqTypeRep does not inline
GHC
ghc-devs at haskell.org
Sun Feb 11 22:44:32 UTC 2018
#14790: eqTypeRep does not inline
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.1-alpha2
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 mpickering):
I think the proposed patch is the wrong idea. What does the core for
`eqTypeRep` look like? that will surely resolve any confusion.
Looking at the line,
{{{
guidance IF_ARGS [52 128] 210 0
discounted size = 180
ANSWER = NO
}}}
That says that the discount for being applied to known arguments i 52 and
128 for each argument respectively. The 210 is the overall size of the
function. If a function is size 80 or less, it is inlined.
What I suspect is happening is that `typeRepFingerprint` is inlined into
`eqTypeRep` which makes it big. This has some potential benefit as
`typeRepFingerprint` is defined as a case but nothing further after that.
I think the correct solution is to mark `typeRepFingerprint` as `{-#
NOINLINE[0] typeRepFingerprint #-}` so that it might only be inlined
in the last phase.
It seems that the fact that `eqWord64` is marked as `INLINE` could be part
of the problem as there is really no hope that we will resolve the
equality of two type fingerprints computed by very complicated
expressions. Another solution could be to stop deriving `Eq` for
`Fingerprint` and instead hand writing the instance and adding a similar
pragma as I suggested above.
Could you test how these would work?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14790#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list