Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail jhm on error and fix benchmarks #5020

Merged
merged 5 commits into from
Aug 27, 2018
Merged

Conversation

liufengyun
Copy link
Contributor

#3138 breaks the benchmarks, but it's not catched by the CI due to a missing setting for JMH.

This PR shows the problem and proposes a fix (in the 2nd commit).

The classpath is intended for type checking, not for compiler run-time.
Thus, they should be passed as compiler options, not JVM options.

It works before because the compiler makes bootstrap classpath
available for type checking. However, we can no longer use bootstrap
classpath after Java 9 support (scala#3138).
@liufengyun
Copy link
Contributor Author

liufengyun commented Aug 26, 2018

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

performance test failed:

Please check http://lamppc37.epfl.ch:8000/pull-5020-08-26-13.38.out for more information

@Blaisorblade
Copy link
Contributor

Was trying to review but was confused by Unrecognized option: -classpath /tmp/1.
That happens because s"-classpath $libs" it taken as one argument and not two (as with "-classpath", libs).

You're right on the rest, tho it's confusing that we allow benchmarks to depend on the whole compiler? If we need that, that's not detected by the tests.

This change

diff --git a/project/Build.scala b/project/Build.scala
index e50bfa733..dabd61558 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -302,7 +302,7 @@ object Build {
   lazy val commonBenchmarkSettings = Seq(
     outputStrategy := Some(StdoutOutput),
     mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench"), // custom main for jmh:run
-    javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in Compile).value).mkString("", ":", "")
+    javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in (`dotty-library`, Compile)).value).mkString("", ":", "")
   )

   // sbt >= 0.13.12 will automatically rewrite transitive dependencies on

changes bench/compile.txt from

../tests/pos/alias.scala
-classpath
/Users/pgiarrusso/git/dotty/compiler/target/scala-2.12/classes:/Users/pgiarrusso/git/dotty/interfaces/target/classes:/Users/pgiarrusso/git/dotty/library/target/scala-2.12/classes:/Users/pgiarrusso/.sbt/boot/scala-2.12.6/lib/scala-library.jar:/Users/pgiarrusso/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-6.0.0-scala-1.jar:/Users/pgiarrusso/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.1.0.jar:/Users/pgiarrusso/.ivy2/cache/org.scala-sbt/compiler-interface/jars/compiler-interface-1.1.6.jar:/Users/pgiarrusso/.ivy2/cache/org.scala-sbt/util-interface/jars/util-interface-1.1.3.jar:/Users/pgiarrusso/.ivy2/cache/org.jline/jline-reader/jars/jline-reader-3.9.0.jar:/Users/pgiarrusso/.ivy2/cache/org.jline/jline-terminal/jars/jline-terminal-3.9.0.jar:/Users/pgiarrusso/.ivy2/cache/org.jline/jline-terminal-jna/jars/jline-terminal-jna-3.9.0.jar:/Users/pgiarrusso/.ivy2/cache/net.java.dev.jna/jna/jars/jna-4.2.2.jar

to

../tests/pos/alias.scala
-classpath
/Users/pgiarrusso/git/dotty/library/target/scala-2.12/classes:/Users/pgiarrusso/.sbt/boot/scala-2.12.6/lib/scala-library.jar

yet benchmarks still seem to work.

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/5020/ to see the changes.

Benchmarks is based on merging with master (28ddeac)

@liufengyun
Copy link
Contributor Author

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/5020/ to see the changes.

Benchmarks is based on merging with master (28ddeac)

val standard_libs = System.getProperty("BENCH_CLASS_PATH")
val compiler_libs = System.getProperty("BENCH_COMPILER_CLASS_PATH")

val libs = if (args.contains("-with-compiler")) compiler_libs else standard_libs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is -with-compiler used anywhere? Where would it be used?
If this is used, we should test it in the project/scripts/cmdTests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, it'll used in the benchmarks to test "dotty". I'll add it to project/scripts/cmdTests.

Copy link
Contributor

@Blaisorblade Blaisorblade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks otherwise OK but I'd like to understand that bit.

@@ -12,6 +12,7 @@ EXPECTED_OUTPUT="hello world"
# check that benchmarks can run
"$SBT" "dotty-bench/jmh:run 1 1 tests/pos/alias.scala"
"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala"
"$SBT" "dotty-bench-bootstrapped/jmh:run 1 1 -with-compiler $($(find compiler/src/dotty -name *.scala -o -name *.java))"
Copy link
Contributor

@allanrenucci allanrenucci Aug 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we test on a single file? This will be fairly slow

It could be one of the macro test that require the compile on the classpath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants