[GHC] #3016: Long compile times, large memory use with static data in 6.10

GHC trac at galois.com
Wed Mar 25 16:03:13 EDT 2009


#3016: Long compile times, large memory use with static data in 6.10
---------------------------------+------------------------------------------
    Reporter:  dons              |        Owner:                  
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:                  
   Component:  Compiler          |      Version:  6.10.1          
    Severity:  normal            |   Resolution:                  
    Keywords:  static data       |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * difficulty:  => Unknown

Comment:

 I've investigated a bit.  The root cause is that GHC is much too keen to
 inline. The big integers are broken into lots of small ones (since we
 don't have big-integer literals), thus
 {{{
 blah = plusInteger (mkInteger 3434433)
                    (timesInteger (mkInteger 9343) (mkInteger 33344))
 }}}
 Although `plusInteger` has quite a big unfolding, it also has large
 "argument discounts" because if you know what constructor the argument is
 built with, the unfolding would get a lot smaller.  The trouble is that in
 GHC 6.10 ''the discount applies when GHC knows '''anything at all''' about
 the argument''.

 In particular, here we know that the argument is a call to `timesInteger`.
 So each literal gives rise to dozens of `plusInteger` and `timesInteger`
 calls, and they are all (fruitlessly) inlined.

 That's the diagnosis. I'm working on a fix, by making inlining a bit less
 eager.

 Simon

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


More information about the Glasgow-haskell-bugs mailing list