Skip to content

Instantly share code, notes, and snippets.

@jairobjunior
Created December 15, 2021 00:40
Show Gist options
  • Save jairobjunior/9cb77209623fc881a371fdeda4090629 to your computer and use it in GitHub Desktop.
Save jairobjunior/9cb77209623fc881a371fdeda4090629 to your computer and use it in GitHub Desktop.
Simple Benchmark block time elapsed measure
object Benchmark {
inline fun <reified T : Any> process(tag: String, block: () -> T) : T {
val now = System.currentTimeMillis()
val result = block.invoke()
val delta = System.currentTimeMillis() - now
println("Benchmark :: $tag :: Took ms=$delta")
return result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment