Skip to content

Commit f6b54a9

Browse files
committed
Run benchmarks directly from sbt
1 parent b7cafd8 commit f6b54a9

File tree

4 files changed

+18
-155
lines changed

4 files changed

+18
-155
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ out/
5858
build/
5959
!out/.keep
6060
testlogs/
61+
bench/result.csv
6162

6263
# Ignore build-file
6364
.packages

bench/src/main/scala/Benchmarks.scala

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,25 @@ object Bench {
1818
val COMPILE_OPTS_FILE = "compile.txt"
1919

2020
def main(args: Array[String]): Unit = {
21-
storeCompileOptions(args)
21+
if (args.isEmpty) {
22+
println("Missing <args>")
23+
return
24+
}
2225

23-
val libs = System.getenv("BOOTSTRAP_APPEND")
26+
val args2 = args.map { arg =>
27+
if (arg.endsWith(".scala")) "../" + arg else arg
28+
}
29+
storeCompileOptions(args2)
30+
31+
val libs = System.getProperty("BENCH_CLASS_PATH")
2432

2533
val opts = new OptionsBuilder()
26-
.jvmArgsPrepend(s"-Xbootclasspath/a:$libs")
34+
.jvmArgsPrepend("-Xbootclasspath/a:" + libs + ":")
2735
.mode(Mode.AverageTime)
28-
.timeUnit(TimeUnit.MICROSECONDS)
29-
.forks(5)
30-
.warmupIterations(5)
31-
.measurementIterations(10)
36+
.timeUnit(TimeUnit.MILLISECONDS)
37+
.forks(1)
38+
.warmupIterations(12)
39+
.measurementIterations(20)
3240
.resultFormat(ResultFormatType.CSV)
3341
.result("result.csv")
3442
.build

bench/templates/launch.mustache

Lines changed: 0 additions & 147 deletions
This file was deleted.

project/Build.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,8 @@ object Build {
828828
dependsOn(`dotty-compiler`).
829829
settings(commonNonBootstrappedSettings).
830830
settings(
831-
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench") // custom main for jmh:run
831+
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench"), // custom main for jmh:run
832+
javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in Compile).value).mkString("", ":", "")
832833
).
833834
enablePlugins(JmhPlugin).
834835
settings(packSettings).

0 commit comments

Comments
 (0)