Remove redundant call to coroutineScope in SuspendBindingBenchmark
This commit is contained in:
parent
ab06a2a3fc
commit
09818a7d50
@ -9,7 +9,6 @@ import kotlinx.benchmark.OutputTimeUnit
|
|||||||
import kotlinx.benchmark.Scope
|
import kotlinx.benchmark.Scope
|
||||||
import kotlinx.benchmark.State
|
import kotlinx.benchmark.State
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.coroutineScope
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import com.github.michaelbull.result.coroutines.binding.binding as coroutineBinding
|
import com.github.michaelbull.result.coroutines.binding.binding as coroutineBinding
|
||||||
@ -54,13 +53,11 @@ class SuspendBindingBenchmark {
|
|||||||
x + y
|
x + y
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun withAsyncSuspend(): Result<Int, Error> = coroutineScope {
|
private suspend fun withAsyncSuspend(): Result<Int, Error> = coroutineBinding {
|
||||||
coroutineBinding {
|
|
||||||
val x = async { provideX().bind() }
|
val x = async { provideX().bind() }
|
||||||
val y = async { provideY().bind() }
|
val y = async { provideY().bind() }
|
||||||
x.await() + y.await()
|
x.await() + y.await()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun provideXBlocking(): Result<Int, Error> {
|
private fun provideXBlocking(): Result<Int, Error> {
|
||||||
Thread.sleep(time)
|
Thread.sleep(time)
|
||||||
|
Loading…
Reference in New Issue
Block a user