Just my first time with ScalaMeter and Scala. I'm trying to test two simple methods and I wrote, based on the samples given in the ScalaMeter Simple benchmark page the following code:
import org.scalameter.api._
object RangeBenchmark extends Bench.LocalTime {
val sizes = Gen.range("size")(10, 150, 10)
val ranges = for {
size <- sizes
} yield 0 until size
def testPow(x: Double) = Math.pow(x, 5)
def testMul(x: Int) = x * x * x * x * x
performance of "Range" in {
measure method "testMul" in {
using(ranges) in { r =>
r.foreach(testMul(_))
}
}
measure method "testPow" in {
using(ranges) in { r =>
r.foreach(testPow(_))
}
}
}
}
and it runs OK. But if I change the predefined test configuration from Bench.LocalTime
to Bench.ForkedTime
or Bench.OfflineReport
I get the following error message:
Test threw exception: java.lang.ClassNotFoundException: org.scalameter.Parameters java.lang.ClassNotFoundException: org.scalameter.Parameters
...
[error] Could not run test RangeBenchmark: java.lang.ClassNotFoundException: org.scalameter.Parameters
I'm running JDK 11, by the way.
So I have two questions:
- Any idea of what I'm doing wrong?
- Is this the correct way for testing simple methods or functions?
Thanks