Benchmarking*
import com.danielasfregola.randomdatagenerator.RandomDataGenerator._
def avgRunTime[A](f: => A, n: Int = 1000): Double = {
val start = Instant.now.toEpochMilli
(0 until n).foreach(_ => f)
val end = Instant.now.toEpochMilli
val diff = end - start
diff / n.toDouble
}
case class BigExample(f1: String, f2: Int, f3: Long, f4: Char, f5: String,
f6: String, f7: Int, f8: Long, f9: Char, f10: String,
f11: String, f12: Int, f13: Long, f14: Char, f15: String,
f16: String, f17: Int, f18: Long, f19: Char, f20: String,
f21: String, f22: Int, f23: Long, f24: Char, f25: String,
f26: String, f27: Int, f28: Long, f29: Char, f30: String)
val big = random[BigExample]
avgRunTime(toArrayFP(big))
avgRunTime(toArrayOOP(big))
*not a serious benchmarking, executed on my laptop