Closed retronym closed 8 years ago
/cc @milessabin
Here's a quick attempt to restore the lzycompute method for module init:
https://github.com/retronym/scala/tree/ticket/SD-225
Bootstrapping the compiler through this change scala-2.12.0-2f20ab6-SNAPSHOT.zip, we get much closer to the 2.11.8 cold performance for hlist.scala
.
⚡ (cd /code/shapeless; time ((/code/scala/build/pack/bin/scalac -J-XX:+UnlockCommercialFeatures -J-XX:+UnlockDiagnosticVMOptions -J-XX:+DebugNonSafepoints -J-XX:+FlightRecorder -J-XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true,stackdepth=1024,loglevel=debug,settings=profile,dumponexitpath=/tmp/newer.jfr -Xlog-implicits @args-2.12.0-RC-small.txt /Users/jz/code/shapeless/core/src/test/scala/shapeless/hlist.scala 2>&1) > /tmp/hlist-newer.log))
real 0m29.768s
user 1m35.219s
sys 0m1.946s
TODO
Wow! Excellent detective work. Was not expecting that one.. Will be more careful and benchmark this kind of stuff next time.
over at https://issues.scala-lang.org/browse/SI-9917 @cheeseng is reporting that between M5 and RC1, the time to compile ScalaTest increased more than 2x. so that's another codebase to test this fix on
@adriaanm @retronym @SethTisue @bvenners just want to report the latest finding, using Scala 2.12.0-RC2, it seems the performance issue is still there, here's the result of sbt test:compile using our 3.1.x branch:
2.11.8 - 602 seconds 2.12.0-RC2 - 1520 seconds
The difference probably is too much for us to swallow. :)
What happens when you compile under -Xsource:2.11? I'm thinking it may be val signature inference. On Wed, Oct 19, 2016 at 02:27 Chua Chee Seng notifications@github.com wrote:
@adriaanm https://github.com/adriaanm @retronym https://github.com/retronym @SethTisue https://github.com/SethTisue @bvenners https://github.com/bvenners just want to report the latest finding, using Scala 2.12.0-RC2, it seems the performance issue is still there, here's the result of sbt test:compile using our 3.1.x branch:
2.11.8 - 602 seconds 2.12.0-RC2 - 1520 seconds
The difference probably is too much for us to swallow. :)
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/scala/scala-dev/issues/225#issuecomment-254761474, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFjy4CalHQhGNoM86vMGyCtzaq1GuZyks5q1eKCgaJpZM4J7mxb .
In any case, I'm investigating this today! Opened a new ticket: https://github.com/scala/scala-dev/issues/246
My theory is that the shapeless slowdown is because of the change to inline the
synchronized { if (moduleVar eq null) moduleVar = new NestedModule }; moduleVar
into the module accessor method, rather than before when this was in a separate method.2.11.8:
2.12.0-RC1:
This has probably interfered with HotSpot's inlining.
I was comparing 2.11.8 and 2.12.0-RC1++ performance on the shapeless test suite, file by file. This was the worst regression, probably due to the relatively high amount of subtype checks that are performed in the implicit search.
The actual output of
-Xlog-implicits
was quite similar, so it seems a similar amount of work was being done.