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

Make benchmarks depend only on library classpath #5024

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions bench/src/main/scala/Benchmarks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ object Bench {
}
storeCompileOptions(args2)

val libs = System.getProperty("BENCH_CLASS_PATH")

val opts = new OptionsBuilder()
.jvmArgsPrepend(s"-classpath $libs", "-Xms2G", "-Xmx2G")
.shouldFailOnError(true)
.jvmArgs("-Xms2G", "-Xmx2G")
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.MILLISECONDS)
.warmupIterations(warmup)
Expand All @@ -54,9 +53,13 @@ object Bench {
def removeCompileOptions: Unit = new File(COMPILE_OPTS_FILE).delete()

def storeCompileOptions(args: Array[String]): Unit = {
val libs = System.getProperty("BENCH_CLASS_PATH")

val file = new File(COMPILE_OPTS_FILE)
val bw = new BufferedWriter(new FileWriter(file))
bw.write(args.mkString("\n"))
bw.write(args.mkString("", "\n", "\n"))
bw.write("-classpath\n")
bw.write(libs)
bw.close()
}

Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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-bootstrapped`, Compile)).value).mkString("", ":", "")
)

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