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
import kotlin.time.Duration | |
import kotlin.time.measureTime | |
fun main() { | |
val durations = mutableListOf<Duration>() | |
repeat(10) { | |
val duration = measureTime { (0..1_000_000).map { it + 1 } } | |
durations += duration | |
} | |
println(durations) |
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
import kotlin.time.Duration | |
import kotlin.time.measureTime | |
fun main() { | |
val durations = mutableListOf<Duration>() | |
repeat(10) { | |
val duration = measureTime { (0..1_000_000).forEach { it + 1 } } | |
durations += duration | |
} | |
println(durations) |
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
import kotlin.time.Duration | |
import kotlin.time.measureTime | |
fun main() { | |
val mapResults = mutableListOf<Duration>() | |
val forEachResults = mutableListOf<Duration>() | |
repeat(10) { | |
mapResults.add(measureTime { (0..1_000_000).map { it + 1 } }) | |
forEachResults.add(measureTime { (0..1_000_000).forEach { it + 1 } }) | |
} |