Created
December 28, 2020 09:24
-
-
Save nihsmik/550f389937674331ee0f0a01e107fe7d to your computer and use it in GitHub Desktop.
Kotlin Performance Test: Iterable<T>.map
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) | |
// [53.2ms, 66.2ms, 53.4ms, 14.5ms, 54.1ms, 17.2ms, 80.3ms, 96.9ms, 17.0ms, 35.9ms] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment