Last active
April 14, 2016 16:57
-
-
Save parasj/937453d8d9c30de90fb24bafab87198d to your computer and use it in GitHub Desktop.
Scala Microbench - time snippet
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
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