[GHC] #14161: Performance Problems on AST Dump

GHC ghc-devs at haskell.org
Tue Aug 29 03:31:10 UTC 2017


#14161: Performance Problems on AST Dump
-------------------------------------+-------------------------------------
        Reporter:  h4ck3rm1k3        |                Owner:  dfeuer
            Type:  bug               |               Status:  patch
        Priority:  low               |            Milestone:  8.2.2
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3894
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by David Feuer <David.Feuer@…>):

 In [changeset:"29da01e0a023eea4bbbfd69dd5d854db721233e6/ghc"
 29da01e0/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="29da01e0a023eea4bbbfd69dd5d854db721233e6"
 Make parsed AST dump output lazily

 Previously, `showAstData` produced a `String`. That `String` would
 then be converted to a `Doc` using `text` to implement
 `-ddump-parsed-ast`. But rendering `text` calculates the length
 of the `String` before doing anything else. Since the AST can be
 very large, this was bad: the whole dump string (potentially hundreds
 of millions of `Char`s) was accumulated in memory.

 Now, `showAstData` produces a `Doc` directly, which seems to work
 a lot better. As an extra bonus, the code is simpler and cleaner.
 The formatting has changed a bit, as the previous ad hoc approach
 didn't really match the pretty printer too well. If someone cares
 enough to request adjustments, we can surely make them.

 Reviewers: austin, bgamari, mpickering, alanz

 Reviewed By: bgamari

 Subscribers: mpickering, rwbarton, thomie

 GHC Trac Issues: #14161

 Differential Revision: https://phabricator.haskell.org/D3894
 }}}

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


More information about the ghc-tickets mailing list