<div dir="ltr">Hello all,<div><br></div><div>Thank you for the comments and apologies that it took a bit of time to get back to you. My colleague Michael and I have taken a stab at a package demonstrating the slowdown. Our hypothesis was that the presence of type declarations, large values/literals, typeclass instantiations and engagement of TH caused at least some of the slowdown we were seeing in our app code. It turns out this was only partially true:</div><div><ul><li>500 random type declarations were a modest 10-25% slower.</li><li>Simply instantiating types with a given class did not contribute that much to the slowdown (around 5% on top of type declarations)</li><li>There was no notable slowdown on large values/literals (false hypothesis)</li><li>TH-enabled derivations were over 100% slower (lens and safecopy used as test subjects)</li><ul><li>lens: ~100% slower</li><li>safecopy: ~125% slower</li></ul><li>The slowdowns appeared to be super-linear in at least some cases. Doubling the declaration count to 1000 increased the % of the slowdown:</li><ul><li>Declarations: 30% slower</li><li>lens TH slowdown: ~100% slower (stayed the same)</li><li>safecopy TH slowdown: ~140% slower</li></ul></ul><div><br></div><div>I'd be happy to create a ticket if this is sufficient support material. It's hard to say these conclusively isolate *all* culprits for the full slowdown we observe in our codebase, but are hopefully at least a significant part.</div></div><div><br></div><div>Here's the package: <a href="https://dl.dropboxusercontent.com/u/58525/ghc-slowdown.tar.gz">https://dl.dropboxusercontent.com/u/58525/ghc-slowdown.tar.gz</a></div><div><br></div><div>Best,</div><div>Oz</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 7, 2015 at 3:39 PM, Simon Marlow <span dir="ltr"><<a href="mailto:marlowsd@gmail.com" target="_blank">marlowsd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just a comment on this one point:<br>
<br>
On 05/04/2015 19:01, Ozgun Ataman wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* With O0 and -j=N the overall wall-clock time is 40% higher, but the<span class=""><br>
CPU time spent is a staggering 7.5X higher (!)<br>
</span></blockquote>
<br>
When looking at Haskell programs executing in parallel, it's normal to see a high CPU time, because the GC threads spin looking for work. The extra CPU time is just time spent spinning, it doesn't imply that the compiler was doing extra work. What matters is the overall wall-clock time - a worse wall-clock time indicates that something has gone wrong.<br>
<br>
We should look at compile-time regression independently of performance issues with -j. Parallel compilation is a new feature and mostly likely needs a lot of tuning. Note that cabal's -j feature is different from GHC's (and is likely to give much more reliable improvements) because it runs multiple compiler instances in parallel.<br>
<br>
Cheers,<br>
Simon<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* With -O0, "cabal repl" load times have gone up by a staggering 2.5X (!)<br>
o 7.8.4: 3 min. 35 seconds<br>
o 7.6.3: 1 min. 2 seconds<br>
* Measuring compile times for individual modules, we see that those<span class=""><br>
that are heavily loaded with lots of types, TH-facilitated type and<br>
typeclass derivations and those that contain large "blobs" of values<br>
directly at the top level now take much longer to compile:<br></span>
o We have 10 modules that each take over 10 seconds<br>
o We have 3 modules that each take over 35 seconds<br>
* Sidenote observation: In general, parallel builds with -j appear to<span class=""><br>
cause a very significant overhead under the "system" part of timing:<br></span>
o Example with 7.6.3, O0: cabal build 140.57s user 13.25s system<span class=""><br>
100% cpu 2:33.70 total<br></span>
o Example with 7.8.4, O0: cabal build 507.83s user 655.43s system<span class=""><br>
549% cpu 3:31.59 total<br>
<br>
<br>
The main hurt here has been the infeasibility of using "cabal repl /<br>
ghci" fast-feedback style development (via emacs, vim, command-line,<br>
etc.), since:<br>
<br></span>
* Unlike "cabal build", "cabal repl" re-compiles from scratch with<span class=""><br>
every invocation ":l App.Foo.Bar", which itself is the necessary<br>
first step when starting to hack on a module (we can then use :r to<br>
somewhat help the situation)<br></span>
* The slowdown is about 2.5X as stated above: What used to take a<span class=""><br>
minute now takes 3.5 minutes.<br></span>
* cabal repl does not seem to benefit from -j at all<br>
* cabal repl 7.8.4 appears to be hurt particularly by the heavier modules<br>
* The heavier modules are often at the top of the compile tree (types,<span class=""><br>
derivations, etc) and are practically loaded on the critical path<br>
all the time<br>
<br>
Let me know if I'm missing anything here and any/all feedback is much<br>
appreciated!<br>
<br>
Cheers,<br>
Oz<br>
<br>
<br></span>
______________________________<u></u>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-<u></u>bin/mailman/listinfo/ghc-devs</a><br>
<br>
</blockquote>
</blockquote></div><br></div>