[GHC] #10980: Deriving Read instance from datatype with N fields leads to N^2 code size growth

GHC ghc-devs at haskell.org
Sat Oct 17 16:45:35 UTC 2015


#10980: Deriving Read instance from datatype with N fields leads to N^2 code size
growth
-------------------------------------+-------------------------------------
        Reporter:  slyfox            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
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 slyfox):

 I've tried to manually move out repeated pieces
 {{{#!hs
     GHC.Read.expectP (Text.Read.Lex.Punc ",");
     GHC.Read.expectP (Text.Read.Lex.Ident "a2");
     GHC.Read.expectP (Text.Read.Lex.Punc "=");
     a3_a1nu <- Text.ParserCombinators.ReadPrec.reset GHC.Read.readPrec;
 }}}
 to a separate binding parameterised by Ident and it seems to be enough
 to make code growth linear with added fields.

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


More information about the ghc-tickets mailing list