Skip to content

Commit ba94db9

Browse files
authored
Merge pull request #3088 from dotty-staging/tune-bench
Tune bench warmups
2 parents c2a30ec + 784dfbf commit ba94db9

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

bench/scripts/compiler.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
find compiler/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run" {} + | sbt
2+
find compiler/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run 5 10" {} + | sbt

bench/scripts/library.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
find library/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run" {} + | sbt
2+
find library/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run 40 30" {} + | sbt

bench/src/main/scala/Benchmarks.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ object Bench {
2222
println("Missing <args>")
2323
return
2424
}
25+
val (intArgs, args1) = args.span(x => try { x.toInt; true } catch { case _: Throwable => false } )
2526

26-
val args2 = args.map { arg =>
27+
val warmup = if (intArgs.length > 0) intArgs(0).toInt else 30
28+
val iteration warmup = if (intArgs.length > 1) intArgs(1).toInt else 20
29+
30+
val args2 = args1.map { arg =>
2731
if ((arg.endsWith(".scala") || arg.endsWith(".java")) && arg.head != '/') "../" + arg
2832
else arg
2933
}
@@ -36,8 +40,8 @@ object Bench {
3640
.mode(Mode.AverageTime)
3741
.timeUnit(TimeUnit.MILLISECONDS)
3842
.forks(1)
39-
.warmupIterations(30)
40-
.measurementIterations(20)
43+
.warmupIterations(warmup)
44+
.measurementIterations(iterations)
4145
.build
4246

4347
val runner = new Runner(opts) // full access to all JMH features, you can also provide a custom output Format here

0 commit comments

Comments
 (0)