Skip to content

Tune bench warmups #3088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 11, 2017
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
2 changes: 1 addition & 1 deletion bench/scripts/compiler.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion bench/scripts/library.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions bench/src/main/scala/Benchmarks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ object Bench {
println("Missing <args>")
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
}
Expand All @@ -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
Expand Down