[GHC] #14955: Musings on manual type class desugaring

GHC ghc-devs at haskell.org
Thu Apr 26 16:44:22 UTC 2018


#14955: Musings on manual type class desugaring
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  SpecConstr
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"3d38e8284b7382844f9862e8d8afbae9c7248b09/ghc" 3d38e82/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="3d38e8284b7382844f9862e8d8afbae9c7248b09"
 Do not unpack class dictionaries with INLINABLE

 Matthew Pickering uncovered a bad performance hole in the way
 that single-method dictionaries work, described in Trac #14955.

 See Note [Do not unpack class dictionaries] in WwLib.

 I tried to fix this 6 years ago, but got it slightly wrong.  This patch
 fixes it, which makes a dramatic improvement in the test case.

 Nofib highlights: not much happening:

   Program           Size    Allocs   Runtime   Elapsed  TotalMem
 -----------------------------------------------------------------
       VSM          -0.3%     +2.7%     -7.4%     -7.4%      0.0%
 cacheprof          -0.0%     +0.1%     +0.3%     +0.7%      0.0%
   integer          -0.0%     +1.1%     +7.5%     +7.5%      0.0%
       tak          -0.1%     -0.2%     0.024     0.024      0.0%
 -----------------------------------------------------------------
       Min          -4.4%     -0.2%     -7.4%     -7.4%     -8.0%
       Max          +0.6%     +2.7%     +7.5%     +7.5%      0.0%
 Geom Mean          -0.1%     +0.0%     +0.1%     +0.1%     -0.2%

 I investigated VSM.  The patch unpacks class dictionaries a bit more
 than before (i.e. does so if there is no INLINABLE pragma). And that
 gives better code in VSM (less dictionary selection etc), but one closure
 gets one word bigger.

 I'll accept these changes in exchange for more robust performance.

 Some ghci.debugger output wobbled around (order of bindings
 being displayed). I have no idea why; but I accepted the changes.
 }}}

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


More information about the ghc-tickets mailing list