[GHC] #13851: Change in specialisation(?) behaviour since 8.0.2 causes 6x slowdown

GHC ghc-devs at haskell.org
Tue Jun 20 11:27:10 UTC 2017


#13851: Change in specialisation(?) behaviour since 8.0.2 causes 6x slowdown
-------------------------------------+-------------------------------------
           Reporter:  mpickering     |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1-rc2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I was investigating some benchmarks and I noticed some odd results if I
 duplicated one of my tests.

 Reproduction: https://github.com/mpickering/probable-eureka

 Looking at the core, it seems that repeating the definition means that one
 of the key functions doesn't get specialised as expected which leads to a
 much slower program.

 Observe that in the first two benchmarks there is a worker function `go ::
 Int# -> Int -> ReaderT Int (StateT Int Identity Int` but in the third
 benchmark this is specialised to `$sgo :: Int# -> Int -> Int -> Int# ->
 Int# -> Identity (Int, Int)`. Removing the duplicate benchmark means that
 specialisation happens properly in the first case as well.

 The proper specialisation also happens in 8.0.2.

 This causes the first two cases to be 6x slower than the last case.

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


More information about the ghc-tickets mailing list