Created
December 15, 2021 00:40
-
-
Save jairobjunior/9cb77209623fc881a371fdeda4090629 to your computer and use it in GitHub Desktop.
Simple Benchmark block time elapsed measure
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
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