Skip to content

Commit

Permalink
Remove unnecessary assembly to run benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
jvican committed Sep 13, 2018
1 parent 4ab3e55 commit f45aa69
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
9 changes: 5 additions & 4 deletions benchmarks/src/main/scala/bloop/HotBloopBenchmark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ abstract class HotBloopBenchmarkBase {
case _ => "-Xmx2G"
}

import bloop.benchmarks.BuildInfo
@Setup(Level.Trial) def spawn(): Unit = {
val configDir = TestUtil.getConfigDirForBenchmark(project)
val base = configDir.getParent
val bloopJarPath = System.getProperty("bloop.jar")
if (bloopJarPath == null) sys.error("System property -Dbloop.jar absent")
val bloopClasspath = BuildInfo.fullCompilationClasspath.map(_.getAbsolutePath).mkString(":")

val jvmArgs = {
val defaultJvmArgs = List(
Expand All @@ -58,8 +58,9 @@ abstract class HotBloopBenchmarkBase {
}

val allArgs = jvmArgs ++ List(
"-jar",
bloopJarPath,
"-cp",
bloopClasspath,
"bloop.Bloop",
"--config-dir",
configDir.toAbsolutePath.toString
)
Expand Down
27 changes: 14 additions & 13 deletions benchmarks/src/main/scala/bloop/ParallelUtestBenchmark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package bloop

import java.io._
import java.util.concurrent.TimeUnit
import bloop.tasks.TestUtil

import bloop.benchmarks.BuildInfo
import bloop.tasks.TestUtil
import org.openjdk.jmh.annotations.Mode.SampleTime
import org.openjdk.jmh.annotations._

Expand All @@ -27,16 +28,16 @@ class ParallelUtestBenchmark {
@Setup(Level.Trial) def spawn(): Unit = {
val configDir = TestUtil.getBloopConfigDir("utest")
val base = configDir.getParent.getParent
val bloopJarPath = System.getProperty("bloop.jar")
if (bloopJarPath == null) sys.error("System property -Dbloop.jar absent")
val bloopClasspath = BuildInfo.fullCompilationClasspath.map(_.getAbsolutePath).mkString(":")

val builder = new ProcessBuilder(
sys.props("java.home") + "/bin/java",
"-Xms1G",
"-Xmx2G",
"-XX:ReservedCodeCacheSize=128m",
"-jar",
bloopJarPath,
"-cp",
bloopClasspath,
"bloop.Bloop",
"--config-dir",
configDir.toAbsolutePath.toString
)
Expand Down Expand Up @@ -110,16 +111,16 @@ class SequentialUtestBenchmark {
@Setup(Level.Trial) def spawn(): Unit = {
val configDir = TestUtil.getBloopConfigDir("utest")
val base = configDir.getParent.getParent
val bloopJarPath = System.getProperty("bloop.jar")
if (bloopJarPath == null) sys.error("System property -Dbloop.jar absent")
val bloopClasspath = BuildInfo.fullCompilationClasspath.map(_.getAbsolutePath).mkString(":")

val builder = new ProcessBuilder(
sys.props("java.home") + "/bin/java",
"-Xms1G",
"-Xmx2G",
"-XX:ReservedCodeCacheSize=128m",
"-jar",
bloopJarPath,
"-cp",
bloopClasspath,
"bloop.Bloop",
"--config-dir",
configDir.toAbsolutePath.toString
)
Expand Down Expand Up @@ -193,16 +194,16 @@ class PipelinedUtestBenchmark {
@Setup(Level.Trial) def spawn(): Unit = {
val configDir = TestUtil.getBloopConfigDir("utest")
val base = configDir.getParent.getParent
val bloopJarPath = System.getProperty("bloop.jar")
if (bloopJarPath == null) sys.error("System property -Dbloop.jar absent")
val bloopClasspath = BuildInfo.fullCompilationClasspath.map(_.getAbsolutePath).mkString(":")

val builder = new ProcessBuilder(
sys.props("java.home") + "/bin/java",
"-Xms1G",
"-Xmx2G",
"-XX:ReservedCodeCacheSize=128m",
"-jar",
bloopJarPath,
"-cp",
bloopClasspath,
"bloop.Bloop",
"--config-dir",
configDir.toAbsolutePath.toString
)
Expand Down
17 changes: 10 additions & 7 deletions project/BuildPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,15 @@ object BuildKeys {

def benchmarksSettings(dep: Reference): Seq[Def.Setting[_]] = List(
Keys.skip in Keys.publish := true,
BuildInfoKeys.buildInfoKeys := Seq[BuildInfoKey](Keys.resourceDirectory in sbt.Test in dep),
BuildInfoKeys.buildInfoKeys := {
val fullClasspathFiles = BuildInfoKey.map(Keys.fullClasspath.in(sbt.Compile).in(dep)) {
case (key, value) => ("fullCompilationClasspath", value.toList.map(_.data))
}
Seq[BuildInfoKey](
Keys.resourceDirectory in sbt.Test in dep,
fullClasspathFiles
)
},
BuildInfoKeys.buildInfoPackage := "bloop.benchmarks",
Keys.javaOptions ++= {
def refOf(version: String) = {
Expand All @@ -222,14 +230,9 @@ object BuildKeys {
.getOrElse("")),
"-DbloopVersion=" + Keys.version.in(dep).value,
"-DbloopRef=" + refOf(Keys.version.in(dep).value),
"-Dbloop.jar=" + AssemblyKeys.assemblyOutputPath.in(AssemblyKeys.assembly).in(dep).value,
"-Dgit.localdir=" + buildBase.value.getAbsolutePath
)
},
Keys.run in JmhKeys.Jmh :=
(Keys.run in JmhKeys.Jmh).dependsOn(AssemblyKeys.assembly.in(dep)).evaluated,
Keys.runMain in JmhKeys.Jmh :=
(Keys.runMain in JmhKeys.Jmh).dependsOn(AssemblyKeys.assembly.in(dep)).evaluated
}
)

import com.typesafe.sbt.site.SitePlugin.{autoImport => SiteKeys}
Expand Down

0 comments on commit f45aa69

Please sign in to comment.