Last active
September 16, 2019 16:57
-
-
Save CanerPatir/652a70f607ee17b3a467426627d75522 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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