diff --git a/bench/scripts/compiler.sh b/bench/scripts/compiler.sh index 246ef6bc334d..9612c2459afb 100755 --- a/bench/scripts/compiler.sh +++ b/bench/scripts/compiler.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -find compiler/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run" {} + | sbt +find compiler/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run 5 10" {} + | sbt diff --git a/bench/scripts/library.sh b/bench/scripts/library.sh index 54724bbbd8f2..ef02ea898398 100755 --- a/bench/scripts/library.sh +++ b/bench/scripts/library.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -find library/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run" {} + | sbt +find library/src/ -type f \( -name "*.scala" -or -name "*.java" \) -exec echo "dotty-bench/jmh:run 40 30" {} + | sbt diff --git a/bench/src/main/scala/Benchmarks.scala b/bench/src/main/scala/Benchmarks.scala index 03e0c2302479..608dba8006a1 100644 --- a/bench/src/main/scala/Benchmarks.scala +++ b/bench/src/main/scala/Benchmarks.scala @@ -22,8 +22,12 @@ object Bench { println("Missing ") return } + val (intArgs, args1) = args.span(x => try { x.toInt; true } catch { case _: Throwable => false } ) - val args2 = args.map { arg => + val warmup = if (intArgs.length > 0) intArgs(0).toInt else 30 + val iteration warmup = if (intArgs.length > 1) intArgs(1).toInt else 20 + + val args2 = args1.map { arg => if ((arg.endsWith(".scala") || arg.endsWith(".java")) && arg.head != '/') "../" + arg else arg } @@ -36,8 +40,8 @@ object Bench { .mode(Mode.AverageTime) .timeUnit(TimeUnit.MILLISECONDS) .forks(1) - .warmupIterations(30) - .measurementIterations(20) + .warmupIterations(warmup) + .measurementIterations(iterations) .build val runner = new Runner(opts) // full access to all JMH features, you can also provide a custom output Format here