[GHC] #12191: 7% allocation regression in Haddock performance tests

GHC ghc-devs at haskell.org
Fri Jun 17 09:30:57 UTC 2016


#12191: 7% allocation regression in Haddock performance tests
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  niteria
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10482            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by niteria):

 This appears to be ordering related. Meaning that when things are ordered
 differently we do different kind of work and it costs more.

 When I changed `Ord UnitId` from my original diff to

 {{{
 instance Ord UnitId where
   nm1 `compare` nm2 =
     -- do the same work, but return the old ordering
     if stableUnitIdCmp nm1 nm2 == LT
       then getKey (getUnique nm1) `compare` getKey (getUnique nm2)
            -- this was enough to stop GHC from being smart and optimize it
 out
       else getUnique nm1 `compare` getUnique nm2
 }}}

 The difference went from `7%` to `0.21%`.
 I will try to narrow this down to functions that are ordering sensitive
 and see if I can make them stable.

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


More information about the ghc-tickets mailing list