GHC: Ticket #2328: Compiling DoCon with 6.8.3 has 3x slow-down compared with 6.8.2
http://ghc.haskell.org/trac/ghc/ticket/2328
<p>
Serge reports that "there remains the question:
why GHC 6.8.3 release candidate builds DoCon-2.11 considerably slower than ghc-6.8.2
(3 times, as I recall)
and needs larger -M memory to build this DoCon".
</p>
<p>
A 3x slow-down wrt 6.8.2 is quite unexpected.
</p>
<p>
Simon
</p>
en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/2328
Trac 1.0.1iglooThu, 05 Jun 2008 01:51:30 GMTmilestone set
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:1
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:1
<ul>
<li><strong>milestone</strong>
set to <em>6.8.3</em>
</li>
</ul>
<p>
Here's where I am so far, using
<a class="ext-link" href="http://haskell.org/docon/distrib/2.11/docon-2.11.zip"><span class="icon"></span>http://haskell.org/docon/distrib/2.11/docon-2.11.zip</a>
</p>
<p>
With 6.8.3 RC:
</p>
<pre class="wiki">$ ghc -O -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -O --make RsePol_.hs -fforce-recomp +RTS -M400M
[...]
$ ghc -O -fglasgow-exts -fallow-overlapping-instances -fallow-undecidable-instances -O -c RsePol_.hs -fforce-recomp -v +RTS -M400M
[...]
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 3830
*** Simplify:
Result size = 2895
Result size = 2691
Result size = 2689
Result size = 2689
*** Specialise:
Result size = 2689
*** Float out (not lambdas, not constants):
Result size = 2751
*** Float inwards:
Result size = 2751
*** Simplify:
Heap exhausted;
Current maximum heap size is 399998976 bytes (381 Mb);
</pre><p>
while 6.8.2 goes:
</p>
<pre class="wiki">[...]
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 3827
*** Simplify:
Result size = 2899
Result size = 2701
Result size = 2699
Result size = 2699
*** Specialise:
Result size = 2699
*** Float out (not lambdas, not constants):
Result size = 2768
*** Float inwards:
Result size = 2768
*** Simplify:
Result size = 309049
Result size = 216314
Result size = 81507
[...]
</pre><p>
(and is also happy with a 200M heap).
</p>
TicketsimonpjThu, 05 Jun 2008 09:21:59 GMT
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:2
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:2
<p>
I believe that the massive (150x!) blow-up when the Simplifier gets going is because instance declarations are inlined bodily. DoCon uses a lot of instances, and the effect is very substantial. As it happens I've been working on a fix, because I've been aware of this for some time, but it's too big a fix to put in 6.8.2.
</p>
<p>
The change between 6.8.2 and 6.8.3 is mysterious though. I don't understand that.
</p>
<p>
Simon
</p>
TicketiglooThu, 05 Jun 2008 12:51:47 GMT
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:3
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:3
<p>
The problem seems to be that this patch:
</p>
<pre class="wiki">[MERGED: Inline implication constraints
Ian Lynagh <igloo@earth.li>**20071215163315
Mon Nov 5 22:08:07 GMT 2007 simonpj@microsoft.com
This patch fixes Trac #1643, where Lennart found that GHC was generating
code with unnecessary dictionaries. The reason was that we were getting
an implication constraint floated out of an INLINE (actually an instance
decl), and the implication constraint therefore wasn't inlined even
though it was used only once (but inside the INLINE). Thus we were
getting:
ic = \d -> <stuff>
foo = _inline_me_ (...ic...)
Then 'foo' gets inlined in lots of places, but 'ic' now looks a bit
big.
But implication constraints should *always* be inlined; they are just
artefacts of the constraint simplifier.
This patch solves the problem, by adding a WpInline form to the HsWrap
type.
</pre><p>
makes more things inlinable, and thus requires more space. Reverting the patch gets us back to 6.8.2 performance. Should I revert it in the 6.8 branch, Simon?
</p>
TicketsimonpjThu, 05 Jun 2008 13:43:30 GMT
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:4
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:4
<p>
Good catch!
</p>
<p>
I'm not sure about reverting, though, because I think it may worsen runtime performance in quite ordinary programs. I'm inclined to keep this one firmly on the radar, but wait see how my upcoming change to instances affects it. Meanwhile, Serge may have to compile with 6.8.2, which is, I admit, rather unsatisfactory.
</p>
<p>
Simon
</p>
TicketiglooThu, 05 Jun 2008 14:34:01 GMTmilestone changed; owner set
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:5
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:5
<ul>
<li><strong>owner</strong>
set to <em>simonpj</em>
</li>
<li><strong>milestone</strong>
changed from <em>6.8.3</em> to <em>6.10 branch</em>
</li>
</ul>
TicketsimonmarFri, 11 Jul 2008 13:12:57 GMTpriority, milestone changed
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:6
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:6
<ul>
<li><strong>priority</strong>
changed from <em>normal</em> to <em>high</em>
</li>
<li><strong>milestone</strong>
changed from <em>6.10 branch</em> to <em>6.10.1</em>
</li>
</ul>
<p>
Sounds like this is important to fix in 6.10.1.
</p>
TicketmaederFri, 11 Jul 2008 15:48:25 GMT
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:7
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:7
<p>
probably related to <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/955" title="bug: more object-code blow-up in ghc-6.8.3 vs. ghc-6.4.2 (both with ... (closed: fixed)">#955</a>
</p>
TicketsimonpjMon, 15 Sep 2008 16:30:42 GMTstatus changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:8
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:8
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
I believe this is now fixed. Hurrah!
</p>
<p>
Simon
</p>
TicketsimonmarTue, 30 Sep 2008 15:39:50 GMTarchitecture changed
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:9
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:9
<ul>
<li><strong>architecture</strong>
changed from <em>Unknown</em> to <em>Unknown/Multiple</em>
</li>
</ul>
TicketsimonmarTue, 30 Sep 2008 15:50:56 GMTos changed
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:10
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:10
<ul>
<li><strong>os</strong>
changed from <em>Unknown</em> to <em>Unknown/Multiple</em>
</li>
</ul>
TicketsimonmarMon, 16 Nov 2009 13:27:26 GMTfailure set
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:11
http://ghc.haskell.org/trac/ghc/ticket/2328#comment:11
<ul>
<li><strong>failure</strong>
set to <em>Compile-time performance bug</em>
</li>
</ul>
Ticket