Skip to content

Instantly share code, notes, and snippets.

@parasj
Last active April 14, 2016 16:57
Show Gist options
  • Save parasj/937453d8d9c30de90fb24bafab87198d to your computer and use it in GitHub Desktop.
Save parasj/937453d8d9c30de90fb24bafab87198d to your computer and use it in GitHub Desktop.
Scala Microbench - time snippet
def time[R](block: => R): (R, Long) = {
val t0 = System.nanoTime()
val result = block
val t1 = System.nanoTime()
(result, t1 - t0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment