Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2018 15:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jwalgemoed/c3d03fa570aa26b9241c4f9d51138196 to your computer and use it in GitHub Desktop.
fun main(args: Array<String>) {
var assign: String
val time = measureTimeMillis {
assign = "Value Assigned"
println("$time ms. spent assigning: '$assign'")
private inline fun measureTimeMillis(block: () -> Unit): Long {
contract {
callsInPlace(block, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
val start = System.currentTimeMillis()
return System.currentTimeMillis() - start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment