GHC: Ticket #5954: Performance regression 7.0 -> 7.2 (still in 7.4)
http://ghc.haskell.org/trac/ghc/ticket/5954
<p>
The program in <tt>nofib/parallel/blackscholes</tt> regressed quite badly in performance between 7.0.x and 7.2.1. This is just sequential performance, no parallelism.
</p>
<p>
With 7.0:
</p>
<pre class="wiki"> 3,084,786,008 bytes allocated in the heap
5,150,592 bytes copied during GC
33,741,048 bytes maximum residency (7 sample(s))
1,541,904 bytes maximum slop
64 MB total memory in use (2 MB lost due to fragmentation)
Generation 0: 5760 collections, 0 parallel, 0.08s, 0.08s elapsed
Generation 1: 7 collections, 0 parallel, 0.01s, 0.01s elapsed
INIT time 0.00s ( 0.00s elapsed)
MUT time 17.43s ( 17.47s elapsed)
GC time 0.09s ( 0.09s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 17.53s ( 17.56s elapsed)
</pre><p>
With 7.2.2:
</p>
<pre class="wiki"> 3,062,127,752 bytes allocated in the heap
4,714,784 bytes copied during GC
34,370,232 bytes maximum residency (7 sample(s))
1,553,968 bytes maximum slop
64 MB total memory in use (2 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 5781 colls, 0 par 0.08s 0.08s 0.0000s 0.0006s
Gen 1 7 colls, 0 par 0.01s 0.01s 0.0014s 0.0017s
INIT time 0.00s ( 0.00s elapsed)
MUT time 23.93s ( 23.93s elapsed)
GC time 0.09s ( 0.09s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 24.02s ( 24.03s elapsed)
</pre><p>
and with 7.4.1:
</p>
<pre class="wiki"> 3,061,924,144 bytes allocated in the heap
4,733,760 bytes copied during GC
34,210,896 bytes maximum residency (7 sample(s))
1,552,640 bytes maximum slop
64 MB total memory in use (2 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 5781 colls, 0 par 0.08s 0.08s 0.0000s 0.0007s
Gen 1 7 colls, 0 par 0.01s 0.01s 0.0015s 0.0017s
INIT time 0.00s ( 0.00s elapsed)
MUT time 23.90s ( 23.91s elapsed)
GC time 0.09s ( 0.09s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 24.00s ( 24.00s elapsed)
</pre>en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/5954
Trac 1.0.1simonpjTue, 20 Mar 2012 12:45:39 GMT
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:1
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:1
<p>
Strange. No GC, no change in allocation. So where is the time going?
</p>
TicketsimonmarThu, 22 Mar 2012 12:20:47 GMT
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:2
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:2
<p>
It looks like the simplifer has duplicated some primops. The program is making more calls to <tt>exp()</tt> at runtime than it was with 7.0. I've spent some time peering at the Core but it's quite complicated, and I haven't been able to narrow down the exact bit of problematic code yet. I suggest we look at it together when you have a chance.
</p>
<p>
(strong possibility that this is the same as <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/5623" title="bug: GHC 7.2.1 Performance Regression: Vector (closed: fixed)">#5623</a>)
</p>
TicketsimonmarMon, 16 Apr 2012 09:21:37 GMTowner set
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:3
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:3
<ul>
<li><strong>owner</strong>
set to <em>simonpj</em>
</li>
</ul>
<p>
Assigning to simonpj as this is probably linked to <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/5623" title="bug: GHC 7.2.1 Performance Regression: Vector (closed: fixed)">#5623</a>, which Simon is working on.
</p>
TicketsimonmarThu, 10 May 2012 08:12:09 GMT
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:4
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:4
<p>
Further on this: we discovered that there are two things going on, neither of which is <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/5623" title="bug: GHC 7.2.1 Performance Regression: Vector (closed: fixed)">#5623</a>.
</p>
<ul><li>Some fusion isn't happening on a <tt>map f [x,y..z]</tt> because the list is being floated out before the RULE can fire. Simon is looking into declaring <tt>enumFromTo</tt> and friends as <tt>CONLIKE</tt>, which might fix this problem. (this regression first appeared in 7.0; the fusion <em>did</em> happen in 6.12.3)
</li></ul><ul><li>There is an opportunity for CSE which 7.0 spots but later versions don't. It is probably a bug in <tt>blackscholes.hs</tt> itself:
</li></ul><pre class="wiki"> nofXd1 = cndf xD1
nofXd2 = cndf xD1
</pre><blockquote>
<p>
Regardless, we don't know why CSE is not catching this any more, and we plan to look into it.
</p>
</blockquote>
TicketmichaltThu, 10 May 2012 11:27:10 GMT
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:5
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:5
<p>
Replying to <a class="new" href="http://ghc.haskell.org/trac/ghc/ticket/5954#comment:4" title="Comment 4 for Ticket #5954">simonmar</a>:
</p>
<blockquote class="citation">
<p>
There is an opportunity for CSE which 7.0 spots but later versions don't. It is probably a bug in <tt>blackscholes.hs</tt> itself:
</p>
<pre class="wiki"> nofXd1 = cndf xD1
nofXd2 = cndf xD1
</pre><blockquote>
<p>
Regardless, we don't know why CSE is not catching this any more, and we plan to look into it.
</p>
</blockquote>
</blockquote>
<p>
I don't have much time right now to look into details, but can this be related to <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/5996" title="bug: fix for CSE (closed: fixed)">#5996</a>?
</p>
TicketsimonmarThu, 10 May 2012 12:37:21 GMT
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:6
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:6
<p>
Replying to <a class="new" href="http://ghc.haskell.org/trac/ghc/ticket/5954#comment:5" title="Comment 5 for Ticket #5954">michalt</a>:
</p>
<blockquote class="citation">
<p>
I don't have much time right now to look into details, but can this be related to <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/5996" title="bug: fix for CSE (closed: fixed)">#5996</a>?
</p>
</blockquote>
<p>
It seems plausible, but I don't know for sure.
</p>
TicketiglooSun, 10 Jun 2012 12:14:40 GMTmilestone changed
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:7
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:7
<ul>
<li><strong>milestone</strong>
changed from <em>7.4.2</em> to <em>7.4.3</em>
</li>
</ul>
TicketbueckingTue, 04 Sep 2012 23:35:06 GMTcc set
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:8
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:8
<ul>
<li><strong>cc</strong>
<em>buecking@…</em> added
</li>
</ul>
TicketiglooWed, 12 Sep 2012 10:26:07 GMTmilestone changed
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:9
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:9
<ul>
<li><strong>milestone</strong>
changed from <em>7.4.3</em> to <em>7.6.2</em>
</li>
</ul>
TicketconradMon, 08 Oct 2012 01:24:33 GMTcc changed
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:10
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:10
<ul>
<li><strong>cc</strong>
<em>conrad@…</em> added
</li>
</ul>
TicketcarterFri, 03 Jan 2014 07:45:16 GMT
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:11
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:11
<p>
is this bug still going on in head?
</p>
TicketthoughtpoliceMon, 14 Jul 2014 13:11:07 GMTpriority changed
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:12
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:12
<ul>
<li><strong>priority</strong>
changed from <em>high</em> to <em>normal</em>
</li>
</ul>
<p>
Lowering priority (these tickets are assigned to older versions, so they're getting bumped as they've been around for a while).
</p>
TicketthoughtpoliceMon, 14 Jul 2014 13:12:10 GMTmilestone changed
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:13
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:13
<ul>
<li><strong>milestone</strong>
changed from <em>7.6.2</em> to <em>7.10.1</em>
</li>
</ul>
<p>
Moving to 7.10.1.
</p>
TicketthoughtpoliceTue, 23 Dec 2014 13:34:10 GMTmilestone changed
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:14
http://ghc.haskell.org/trac/ghc/ticket/5954#comment:14
<ul>
<li><strong>milestone</strong>
changed from <em>7.10.1</em> to <em>7.12.1</em>
</li>
</ul>
<p>
Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.
</p>
Ticket