Skip to content

Instantly share code, notes, and snippets.

@anderssonfilip
Last active August 29, 2015 13:57
Show Gist options
  • Save anderssonfilip/9620813 to your computer and use it in GitHub Desktop.
Save anderssonfilip/9620813 to your computer and use it in GitHub Desktop.
var ts: List[Long] = List.empty
def time[R](block: => R): R = {
val t0 = System.nanoTime()
val result = block
val t1 = System.nanoTime()
val t = t1 - t0
ts = ts ++ List(t)
result
}
val slickDriver = "scala.slick.driver.H2Driver"
val jdbcDriver = "org.h2.Driver"
var name = List("test3", "test23", "test30")
while (name != Nil) {
for (j <- 1 to 11) {
time {
val url = "jdbc:h2:" + name.head
scala.slick.model.codegen.SourceCodeGenerator.main(
Array(slickDriver, jdbcDriver, url, ".", ""))
}
}
name = name.tail
}
for (i <- 0 to 2) {
val t = ts.drop(i * 11).take(11).drop(1) // drop the first generation on each table
val avg: Double = t.sum / 10.0
println(avg / 1000000000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment