I'm quite confusing on how can ScalaMeter chain configuration like this
val standardConfig = config(
Key.exec.minWarmupRuns -> 5,
Key.exec.maxWarmupRuns -> 10,
Key.exec.benchRuns -> 10,
Key.verbose -> true
) withWarmer(new Warmer.Default)
The first config(...)
expression returns MeasureBuilder[T, U]
type, this I understand.
However, how can we chain the second expression withWarmer(new Warmer.Default)
which also returns MeasureBuilder
type.
At first, I guess that MeasureBuilder
type implement apply method that allow us to do this, but at the last step before measuring the performance of a piece of code we need
val partime = standardConfig measure {
...
}
where measure { ... }
return Quantity[U]
type which is not MeasureBuilder
.
So, How can ScalaMeter configuration chain the expression like that?