[GHC] #5642: Deriving Generic of a big type takes a long time and lots of space
GHC
ghc-devs at haskell.org
Mon Jun 27 21:15:17 UTC 2016
#5642: Deriving Generic of a big type takes a long time and lots of space
-------------------------------------+-------------------------------------
Reporter: basvandijk | Owner: bgamari
Type: bug | Status: merge
Priority: normal | Milestone:
Component: Compiler | Version: 7.3
Resolution: | Keywords: deriving-
| perf, Generics
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case: T5642
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2304
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by rrnewton):
One more small experiment. Before diving into the compiler internals, I
thought it might be possible to do standard test case minimization. I.e.
can we create some stub definitions for the relevant bits of
`GHC.Generics`, while preserving the bad behavior?
[https://gist.github.com/rrnewton/df17230b748df4ce1f06b49831348000 The
file in this gist] attempts to do so, using the following stub
definitions:
{{{
class Generic a where
from :: a -> M1 a
data M1 a where
M1 :: b -> M1 a
data U1 p = U1
data (:+:) (f :: * -> *) (g :: * -> *) p = L1 (f p) | R1 (g p)
}}}
This is a lower bound -- it fails to produce the really slow behavior. It
is simplified enough that the time for compiling just the "from" case
drops from 5.7s all the way down to 0.85s. Getting back to the bad
behavior will require putting more of the complexity of "M1" back into
play...
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5642#comment:46>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list