Skip to content

Instantly share code, notes, and snippets.

@CanerPatir
Last active September 16, 2019 16:57
Show Gist options
  • Select an option

  • Save CanerPatir/652a70f607ee17b3a467426627d75522 to your computer and use it in GitHub Desktop.

Select an option

Save CanerPatir/652a70f607ee17b3a467426627d75522 to your computer and use it in GitHub Desktop.
fun concurrencyTest(){
val time1 = measureTimeMillis {
runBlocking {
val listOfDeferred: List<Deferred<Int>> = (1..50).map { i ->
async {
delay(100)
Int.MIN_VALUE
}
}
}
}
println("operation1: $time1 ms")
val time2 = measureTimeMillis {
(1..50).map { i ->
Thread.sleep(100)
Int.MIN_VALUE
}
}
println("operation2: $time2 ms")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment