Skip to content

Version Bump Party #69

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

Merged
merged 1 commit into from
May 21, 2018
Merged
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
18 changes: 10 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ name := "compiler-benchmark"

version := "1.0-SNAPSHOT"

def scala211 = "2.11.11"
def dottyLatest = "0.2.0-RC1"
scalaVersion in ThisBuild := scala211
def scala212 = "2.12.6"
def dottyLatest = "0.8.0-RC1"
scalaVersion in ThisBuild := scala212
val JmhConfig = config("jmh")

commands += Command.command("testAll") { s =>
"test:compile" ::
Expand All @@ -16,7 +17,7 @@ commands += Command.command("testAll") { s =>
s"++$dottyLatest" ::
"compilation/test" ::
"hot -psource=vector -wi 1 -i 1 -f1" ::
s"++$scala211" ::
s"++$scala212" ::
"micro/jmh:run -w1 -f1" ::
s
}
Expand Down Expand Up @@ -57,7 +58,7 @@ lazy val compilation = addJmh(project).settings(
if (isDotty.value) "ch.epfl.lamp" %% "dotty-compiler" % scalaVersion.value
else scalaOrganization.value % "scala-compiler" % scalaVersion.value
},
crossScalaVersions := List(scala211, dottyLatest),
crossScalaVersions := List(scala212, dottyLatest),
unmanagedSourceDirectories.in(Compile) +=
sourceDirectory.in(Compile).value / (if (isDotty.value) "dotc" else "scalac"),
mainClass in (Jmh, run) := Some("scala.bench.ScalacBenchmarkRunner"),
Expand Down Expand Up @@ -122,19 +123,20 @@ commands += Command.arb(profParser)((s: State, line: String) => {
def command(outDir: File): String = "-prof perfnorm"
}

val profs = List(perfNorm, basic, async, jfr)
val profs = List(jfr, perfNorm, basic, async)
val commands: List[String] = profs.flatMap { (prof: Profiler) =>
val outDir = file(s"target/profile-${prof.name}")
IO.createDirectory(outDir)
List(line + " -jvmArgs -Dsun.reflect.inflationThreshold=0 " + prof.command(outDir) + s" -o ${(outDir / "jmh.log").getAbsolutePath} -rf json -rff ${(outDir / "result.json").getAbsolutePath}", BasicCommandStrings.FailureWall)
}
s.copy(remainingCommands = BasicCommandStrings.ClearOnFailure :: commands ++ s.remainingCommands)
val remainingCommands1 = (BasicCommandStrings.ClearOnFailure :: commands).map(s => Exec(s, None)) ++ s.remainingCommands
s.copy(remainingCommands = remainingCommands1)
})


def addJmh(project: Project): Project = {
// IntelliJ SBT project import doesn't like sbt-jmh's default setup, which results the prod and test
// output paths overlapping. This is because sbt-jmh declares the `jmh` config as extending `test`, but
// configures `classDirectory in Jmh := classDirectory in Compile`.
project.enablePlugins(JmhPlugin).overrideConfigs(config("jmh").extend(Compile))
project.enablePlugins(JmhPlugin).overrideConfigs(JmhConfig.extend(Compile))
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait BenchmarkDriver extends BaseBenchmarkDriver {
depsClasspath.mkString(File.pathSeparator))
}
ctx.setSetting(ctx.settings.migration, false)
ctx.setSetting(ctx.settings.d, tempDir.getAbsolutePath)
ctx.setSetting(ctx.settings.outputDir, tempDir.getAbsolutePath)
ctx.setSetting(ctx.settings.language, List("Scala2"))
val compiler = new dotty.tools.dotc.Compiler
val reporter = dotty.tools.dotc.Bench.doCompile(compiler, allArgs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import java.io._
import java.nio.file._
import java.util.concurrent.TimeUnit

import org.openjdk.jmh.annotations.Mode.SampleTime
import org.openjdk.jmh.annotations.Mode
import org.openjdk.jmh.annotations._

@State(Scope.Benchmark)
@BenchmarkMode(Array(SampleTime))
@BenchmarkMode(Array(org.openjdk.jmh.annotations.Mode.SampleTime))
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 10, time = 10, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 10, time = 10, timeUnit = TimeUnit.SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ object ScalacBenchmarkStandalone {
}

@State(Scope.Benchmark)
@BenchmarkMode(Array(SingleShotTime))
@BenchmarkMode(Array(org.openjdk.jmh.annotations.Mode.SingleShotTime))
@OutputTimeUnit(TimeUnit.MILLISECONDS)
// TODO -Xbatch reduces fork-to-fork variance, but incurs 5s -> 30s slowdown
@Fork(value = 16, jvmArgs = Array("-XX:CICompilerCount=2", "-Xms2G", "-Xmx2G"))
Expand All @@ -120,7 +120,7 @@ class ColdScalacBenchmark extends ScalacBenchmark {
def compile(): Unit = compileImpl()
}

@BenchmarkMode(Array(SampleTime))
@BenchmarkMode(Array(org.openjdk.jmh.annotations.Mode.SampleTime))
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 30, timeUnit = TimeUnit.SECONDS)
Expand All @@ -130,7 +130,7 @@ class WarmScalacBenchmark extends ScalacBenchmark {
def compile(): Unit = compileImpl()
}

@BenchmarkMode(Array(SampleTime))
@BenchmarkMode(Array(org.openjdk.jmh.annotations.Mode.SampleTime))
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 10, time = 10, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 10, time = 10, timeUnit = TimeUnit.SECONDS)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.1.5
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
logLevel := Level.Warn

// sbt-jmh plugin - pulls in JMH dependencies too
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4")

// sbt-dotty plugin - to support `scalaVersion := "0.x"`
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.1.2")
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.2.2")