Created
December 15, 2018 02:50
-
-
Save felixchez/8132a7db4431c9d2b1a139703339cfee to your computer and use it in GitHub Desktop.
kotlin_benchmark_inline_function
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
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