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

GHC ghc-devs at haskell.org
Mon Oct 19 09:50:42 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 simonpj):

 Slyfox, can you give a small example of what the code looks like before
 and after your change?  I can see that turning 4 lines into 1 (by creating
 a new function definition) is good, but at best that makes it 4 times
 smaller, which is not the difference between linear and quadratic.

 I'd like to understand where the quadratic-ness is coming from!

 Thanks for investigating this.

 Simon

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


More information about the ghc-tickets mailing list