Skip to content

Instantly share code, notes, and snippets.

@talosdev
Created July 15, 2019 08:41
Show Gist options
  • Select an option

  • Save talosdev/5dd7bae8edadc30565b4d7dcf1b8570a to your computer and use it in GitHub Desktop.

Select an option

Save talosdev/5dd7bae8edadc30565b4d7dcf1b8570a to your computer and use it in GitHub Desktop.
inline fun<T> measureTimeMillisPair(function: () -> T): Pair<T, Long> {
val startTime = System.currentTimeMillis()
val result: T = function.invoke()
val endTime = System.currentTimeMillis()
return Pair(result, endTime - startTime)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment