Skip to content

Commit 8635f1d

Browse files
author
Antoine Brunner
committed
Change what was suggested in PR comments
1 parent 26b9899 commit 8635f1d

File tree

9 files changed

+6
-3
lines changed

9 files changed

+6
-3
lines changed

bench-run/src/main/scala/Main.scala renamed to bench-run/src/main/scala/dotty/tools/benchmarks/Main.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ object Bench {
1818

1919
val (intArgs, args1) = args.span(x => try { x.toInt; true } catch { case _: Throwable => false } )
2020

21-
val warmup = if (intArgs.length > 0) intArgs(0).toInt else 20
22-
val iterations = if (intArgs.length > 1) intArgs(1).toInt else 20
23-
val forks = if (intArgs.length > 2) intArgs(2).toInt else 1
21+
def getIntArg(i: Int, default: Int): Int =
22+
if (intArgs.length > i) intArgs(i).toInt else default
23+
24+
val warmup = getIntArg(0, 20)
25+
val iterations = getIntArg(1, 20)
26+
val forks = getIntArg(2, 1)
2427

2528
if (args1.isEmpty) {
2629
println("Error: no benchmark was specified.")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)