Skip to content
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
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [8, 11, 17]
java: [8, 21, 25]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: coursier/cache-action@v6
- uses: actions/setup-java@v2
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{matrix.java}}
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Test
run: sbt testAll
28 changes: 10 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ name := "compiler-benchmark"

version := "1.0-SNAPSHOT"

def scala212 = "2.12.15"
def dottyLatest = "0.25.0"
ThisBuild / scalaVersion := scala212
def scala213 = "2.13.16"
ThisBuild / scalaVersion := scala213
val JmhConfig = config("jmh")

commands += Command.command("testAll") { s =>
"Test/compile" ::
"compilation/test" ::
"hot -psource=scalap -wi 1 -i 1 -f1" ::
s"++$dottyLatest" ::
"compilation/test" ::
"hot -psource=re2s -wi 1 -i 1 -f1" ::
s"++$scala212" ::
"micro/Jmh/run -w1 -f1" ::
s
}
Expand Down Expand Up @@ -53,15 +48,12 @@ lazy val compilation = addJmh(project).settings(
// We should be able to switch this project to a broad range of Scala versions for comparative
// benchmarking. As such, this project should only depend on the high level `MainClass` compiler API.
description := "Black box benchmark of the compiler",
libraryDependencies += {
if (isDotty.value) "ch.epfl.lamp" %% "dotty-compiler" % scalaVersion.value
else scalaOrganization.value % "scala-compiler" % scalaVersion.value
},
crossScalaVersions := List(scala212, dottyLatest),
libraryDependencies += scalaOrganization.value % "scala-compiler" % scalaVersion.value,
crossScalaVersions := List(scala213),
Compile / unmanagedSourceDirectories +=
(Compile / sourceDirectory).value / (if (isDotty.value) "dotc" else "scalac"),
(Compile / sourceDirectory).value / "scalac",
Jmh / run / mainClass := Some("scala.bench.ScalacBenchmarkRunner"),
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.2" % Test,
Test / testOptions += Tests.Argument(TestFrameworks.JUnit),
Test / test / fork := true, // jmh scoped tasks run with fork := true.
).settings(addJavaOptions).dependsOn(infrastructure)
Expand All @@ -70,7 +62,7 @@ lazy val javaCompilation = addJmh(project).settings(
description := "Black box benchmark of the java compiler",
crossPaths := false,
Jmh / run / mainClass := Some("scala.bench.ScalacBenchmarkRunner"),
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.2" % Test,
Test / testOptions += Tests.Argument(TestFrameworks.JUnit),
Test / test/ fork := true // jmh scoped tasks run with fork := true.
).settings(addJavaOptions).dependsOn(infrastructure)
Expand Down Expand Up @@ -101,14 +93,14 @@ lazy val addJavaOptions = javaOptions ++= {
)
}

addCommandAlias("hot", "compilation/jmh:run HotScalacBenchmark -foe true")
addCommandAlias("hot", "compilation/Jmh/run HotScalacBenchmark -foe true")

addCommandAlias("cold", "compilation/jmh:run ColdScalacBenchmark -foe true")
addCommandAlias("cold", "compilation/Jmh/run ColdScalacBenchmark -foe true")

commands ++= build.Profiler.commands

// duplicated in project/build.sbt
val jmhV = System.getProperty("jmh.version", "1.31")
val jmhV = System.getProperty("jmh.version", "1.37")

def addJmh(project: Project): Project = {
// IntelliJ SBT project import doesn't like sbt-jmh's default setup, which results the prod and test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static class NormTimeResult extends Result<NormTimeResult> {
private final long ops;

public NormTimeResult(String prefix, long cycles, long instructions) {
super(ResultRole.SECONDARY, Defaults.PREFIX + prefix, of(Double.NaN), "---", AggregationPolicy.AVG);
super(ResultRole.SECONDARY, prefix, of(Double.NaN), "---", AggregationPolicy.AVG);
this.prefix = prefix;
this.scalar = cycles;
this.ops = instructions;
Expand All @@ -111,7 +111,7 @@ public NormTimeResult aggregate(Collection<NormTimeResult> results) {

@Override
protected Aggregator<NormTimeResult> getIterationAggregator() {
NormTimeResultAggregator normTimeResultAggregator = new NormTimeResultAggregator(Defaults.PREFIX + prefix);
NormTimeResultAggregator normTimeResultAggregator = new NormTimeResultAggregator(prefix);
return (Aggregator<NormTimeResult>) (Object) normTimeResultAggregator;
}

Expand Down
1 change: 0 additions & 1 deletion corpus/scala/21d12e9/df29ebb

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.8.2
sbt.version=1.11.6
2 changes: 1 addition & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val jmhV = System.getProperty("jmh.version", "1.31") // duplicated in build.sbt
val jmhV = System.getProperty("jmh.version", "1.37") // duplicated in build.sbt

libraryDependencies ++= List(
"org.openjdk.jmh" % "jmh-core" % jmhV,
Expand Down
5 changes: 1 addition & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
logLevel := Level.Warn

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

// sbt-dotty plugin - to support `scalaVersion := "0.x"`
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")