[GHC] #13564: Why does memory usage increase so much during CoreTidy?

GHC ghc-devs at haskell.org
Sun Apr 30 19:40:01 UTC 2017


#13564: Why does memory usage increase so much during CoreTidy?
-------------------------------------+-------------------------------------
        Reporter:  rwbarton          |                Owner:  rwbarton
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Happily the cause turns out to be simple. In `tidyUnfolding` we tidy the
 RHS of a stable `CoreUnfolding`. But `CoreUnfolding` also has fields
 `uf_is_value`, `uf_is_conlike`, etc., which are cached computations on the
 original RHS. Apparently it's common for these to never be used at any
 point (the iface will only record `uf_guidance`); so we should evaluate
 these in `tidyUnfolding`, or just throw away the ones that won't ever be
 used.

 I'm in the process of verifying this fix still has the expected result
 with HEAD.

 There might be further improvements to be made here, but indications are
 that this fix at least decreases memory usage during code generation to
 the point where it is no longer larger than the peak usage during
 simplification. In other words, max memory usage can't be reduced any more
 from this side.

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


More information about the ghc-tickets mailing list