Last active
August 29, 2015 13:57
-
-
Save anderssonfilip/9620813 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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