[GHC] #14364: Reduce repetition in derived Read instances

GHC ghc-devs at haskell.org
Wed Oct 18 12:18:29 UTC 2017


#14364: Reduce repetition in derived Read instances
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10980 #7258      |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by tdammers):

 Some manual experimentation using hand-written `Read` instances suggests
 that factoring out `readField` would indeed cut down compile times
 significantly.

 For a 10-field record type, the generated `Read` instance and a hand-
 written one with all the field parsers written inline both take 0.14
 seconds to compile, and the register allocator shows up high in the
 profile. Manually rewriting the `Read` instance to use `readField` instead
 cuts it to 0.11 seconds, so I am now implementing this in `TcGenDeriv` to
 see how much of a difference it makes on larger record types.

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


More information about the ghc-tickets mailing list