[GHC] #9557: Deriving instances is slow

GHC ghc-devs at haskell.org
Sun Sep 21 15:25:01 UTC 2014


#9557: Deriving instances is slow
-------------------------------------+-------------------------------------
              Reporter:  Feuerbach   |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:  #8731
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Deriving a lot of instances for a lot of large types generates a lot of
 code. Language.Haskell.Exts.Annotated.Syntax desugared to a program with
 126,396 terms and took 24.2 seconds to build (with -O0). By comparison,
 the longest (in terms of lines, roughly 2100) module
 Language.Haskell.Exts.Annotated.ExactPrint desugared to a program with
 only 12,181 terms and it took 2.7 seconds to build. So, I don't think
 there is anything wrong with the speed of deriving instances specifically.

 Now, it's possible that instance deriving could be made to generate
 smaller code than it currently does for some particular classes... but I
 didn't notice anything amiss scanning through the generated instances for
 Decl (with `-dsuppress-all -ddump-deriv -ddump-to-file`). So, I don't
 really think deriving is to blame here.

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


More information about the ghc-tickets mailing list