Skip to content

Commit

Permalink
Remove redundant call to coroutineScope in SuspendBindingBenchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbull committed Mar 10, 2024
1 parent 1df8f72 commit 4974cb7
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import kotlinx.benchmark.OutputTimeUnit
import kotlinx.benchmark.Scope
import kotlinx.benchmark.State
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import com.github.michaelbull.result.coroutines.binding.binding as coroutineBinding
Expand Down Expand Up @@ -54,12 +53,10 @@ class SuspendBindingBenchmark {
x + y
}

private suspend fun withAsyncSuspend(): Result<Int, Error> = coroutineScope {
coroutineBinding {
val x = async { provideX().bind() }
val y = async { provideY().bind() }
x.await() + y.await()
}
private suspend fun withAsyncSuspend(): Result<Int, Error> = coroutineBinding {
val x = async { provideX().bind() }
val y = async { provideY().bind() }
x.await() + y.await()
}

private fun provideXBlocking(): Result<Int, Error> {
Expand Down

0 comments on commit 4974cb7

Please sign in to comment.