Skip to content

Instantly share code, notes, and snippets.

@lossyrob
Created January 30, 2017 02:17
Show Gist options
  • Save lossyrob/fd9ba98ca58c208144126aa4674a88ea to your computer and use it in GitHub Desktop.
Save lossyrob/fd9ba98ca58c208144126aa4674a88ea to your computer and use it in GitHub Desktop.
Simple timing method I end up rewriting a lot
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