Skip to content

Commit 90bb7bc

Browse files
committed
Tune bench warmups
1 parent 129cd1e commit 90bb7bc

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-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: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ 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+
var warmup = 30
28+
var iterations = 20
29+
30+
if (intArgs.length > 0) warmup = intArgs(0).toInt
31+
if (intArgs.length > 1) iterations = intArgs(1).toInt
32+
33+
val args2 = args1.map { arg =>
2734
if ((arg.endsWith(".scala") || arg.endsWith(".java")) && arg.head != '/') "../" + arg
2835
else arg
2936
}
@@ -36,8 +43,8 @@ object Bench {
3643
.mode(Mode.AverageTime)
3744
.timeUnit(TimeUnit.MILLISECONDS)
3845
.forks(1)
39-
.warmupIterations(30)
40-
.measurementIterations(20)
46+
.warmupIterations(warmup)
47+
.measurementIterations(iterations)
4148
.build
4249

4350
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)