Skip to content

Instantly share code, notes, and snippets.

@felixchez
Created December 15, 2018 02:50
Show Gist options
  • Save felixchez/8132a7db4431c9d2b1a139703339cfee to your computer and use it in GitHub Desktop.
Save felixchez/8132a7db4431c9d2b1a139703339cfee to your computer and use it in GitHub Desktop.
kotlin_benchmark_inline_function
inline fun benchmark(block: () -> Unit): Unit {
val startTime = System.nanoTime()
block()
val endTime = System.nanoTime()
Log.i("Time take to execute in ${endTime - startTime)")
}
===
fun onClickHandler() {
// onClickListener flows that handling Network Request, Database Persistence and UI Rendering
}
benchmark(onClickHandler())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment