Skip to content

Commit ca98207

Browse files
committed
Fix benchmarks compilation
1 parent 3ed9e38 commit ca98207

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

benchmarks/src/jmh/kotlin/benchmarks/ChannelSinkBenchmark.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ open class ChannelSinkBenchmark {
2121
@Benchmark
2222
fun channelPipeline(): Int = runBlocking {
2323
Channel
24-
.range(1, 1_000_000, Unconfined)
25-
.filter(Unconfined) { it % 4 == 0 }
24+
.range(1, 1_000_000, Dispatchers.Unconfined)
25+
.filter(Dispatchers.Unconfined) { it % 4 == 0 }
2626
.fold(0) { a, b -> a + b }
2727
}
2828

29-
private fun Channel.Factory.range(start: Int, count: Int, context: CoroutineContext) = produce(context) {
29+
private fun Channel.Factory.range(start: Int, count: Int, context: CoroutineContext) = GlobalScope.produce(context) {
3030
for (i in start until (start + count))
3131
send(i)
3232
}

benchmarks/src/jmh/kotlin/benchmarks/GuideSyncBenchmark.kt

Whitespace-only changes.

benchmarks/src/jmh/kotlin/benchmarks/ParametrizedDispatcherBase.kt

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {
2424
override lateinit var coroutineContext: CoroutineContext
2525
var closeable: Closeable? = null
2626

27+
@UseExperimental(InternalCoroutinesApi::class)
2728
@Setup
2829
open fun setup() {
2930
coroutineContext = when {

benchmarks/src/jmh/kotlin/benchmarks/actors/PingPongWithBlockingContext.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import kotlin.coroutines.*
2626
@State(Scope.Benchmark)
2727
open class PingPongWithBlockingContext {
2828

29+
@UseExperimental(InternalCoroutinesApi::class)
2930
private val experimental = ExperimentalCoroutineDispatcher(8)
31+
@UseExperimental(InternalCoroutinesApi::class)
3032
private val blocking = experimental.blocking(8)
3133
private val threadPool = newFixedThreadPoolContext(8, "PongCtx")
3234

@@ -54,8 +56,8 @@ open class PingPongWithBlockingContext {
5456

5557
private suspend fun runPingPongs(pingContext: CoroutineContext, pongContext: CoroutineContext) {
5658
val me = Channel<PingPongActorBenchmark.Letter>()
57-
val pong = pongActorCoroutine(pongContext)
58-
val ping = pingActorCoroutine(pingContext, pong)
59+
val pong = CoroutineScope(pongContext).pongActorCoroutine()
60+
val ping = CoroutineScope(pingContext).pingActorCoroutine(pong)
5961
ping.send(PingPongActorBenchmark.Letter(Start(), me))
6062

6163
me.receive()

0 commit comments

Comments
 (0)