Created
January 30, 2017 02:17
-
-
Save lossyrob/fd9ba98ca58c208144126aa4674a88ea to your computer and use it in GitHub Desktop.
Simple timing method I end up rewriting a lot
This file contains 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[T](msg: String)(f: => T) = { | |
val start = System.currentTimeMillis | |
val v = f | |
val end = System.currentTimeMillis | |
println(s"[TIMING] $msg: ${java.text.NumberFormat.getIntegerInstance.format(end - start)} ms") | |
v | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment