Overview of Reactive Scrabble Benchmarks
masterFlow against RxJava2 and Reactor. The benchmarks are adaptations of work by José Paumard and David Karnok.repository·master·Indexed 11 days ago
https://github.com/kotlin/kotlinx.coroutinesA library providing support for Kotlin coroutines to enable efficient asynchronous programming through structured concurrency. It supports JVM, JS, Native, and Android platforms. The project includes specialized integration modules for Guava ListenableFuture, SLF4J MDC, and Google Play Services Tasks API, as well as test utilities via kotlinx-coroutines-test.
Flow against RxJava2 and Reactor. The benchmarks are adaptations of work by José Paumard and David Karnok.The library is organized into several modules depending on your target platform and requirements:
launch, async), Dispatchers (Main, Default), Flow, Channel, Mutex, Semaphore, and scope builders (coroutineScope, supervisorScope, withContext, withTimeout).Dispatchers.IO and CompletableFuture integration.Promise integration.runTest, TestScope, and Dispatchers.setMain.DebugProbes and CoroutinesTimeout.Dispatchers.Main implementations for Android, JavaFX, and Swing.reactive directory in kotlinx.coroutines provides specialized modules that allow seamless integration between Kotlin Coroutines and various reactive stream libraries. These modules provide utilities to convert between Coroutine types (like Flow) and reactive types (like Publisher or Observable).The kotlinx-coroutines-play-services module provides extension functions to bridge Google Play Services Tasks API with Kotlin Coroutines. This allows you to treat asynchronous Play Services operations as suspending functions or Deferred values.
| Name | Description |
|---|---|
Task.asDeferred() | Converts a Task into a Deferred |
Task.await() | Awaits for completion of the Task (cancellable) |
Deferred.asTask() | Converts a Deferred value to a Task |
import kotlinx.coroutines.tasks.await
import kotlinx.coroutines.tasks.asDeferred
import kotlinx.coroutines.tasks.asTaskThe kotlinx-coroutines-javafx module provides the necessary coroutine dispatchers to interact with the JavaFX UI thread. It provides both a specific Dispatchers.JavaFx context and an implementation of Dispatchers.Main tailored for JavaFX applications. Use these dispatchers to ensure that UI updates and interactions with JavaFX components occur on the correct thread.
For a detailed tutorial on UI programming with coroutines, refer to the Guide to UI programming with coroutines.
kotlinx-coroutines-test package provides testing support for kotlinx-coroutines specifically for Kotlin/JS environments. It allows you to test coroutine-based code in JavaScript-targeted projects.The kotlinx-coroutines-swing module provides the necessary coroutine dispatchers for interacting with Swing UI components. It provides:
Dispatchers.Swing: A dispatcher specifically for the Swing event dispatch thread (EDT).Dispatchers.Main: An implementation of the main dispatcher that, when used in a Swing environment, defaults to the Swing EDT.This allows you to launch coroutines that can safely update UI components without manual SwingUtilities.invokeLater calls.
kotlinx-coroutines-jdk9 module provides utilities for working with Java Flow within Kotlin coroutines. It acts as a thin wrapper over kotlinx-coroutines-reactive, providing compatibility for the Java Flow API in a way similar to how Reactive Streams are handled.The kotlinx.coroutines project provides specialized integration modules to bridge coroutines with various asynchronous, callback-based, or future-based libraries. These modules allow you to convert external asynchronous types into coroutine-friendly constructs like Deferred or suspend functions.
Available integration modules include:
ListenableFuture.MDC (Mapped Diagnostic Context) to ensure coroutine context propagation in logging.Tasks API (primarily for Android development).A Flow is a sequential stream of values produced asynchronously. While a suspending function returns a single value, a Flow allows you to work with multiple sequential values over time.
You can build flow pipelines consisting of three roles:
Values move through the pipeline from upstream (the emitter) to downstream (the collector).
import kotlinx.coroutines.flow.*
suspend fun main() {
// The emitter produces values
flowOf(0x4B, 0x6F, 0x74, 0x6C, 0x69, 0x6E)
// The intermediate operator consumes values,
// applies an operation, and returns another flow
.map { value -> value.toChar() }
// The collector consumes the transformed values
.collect { updatedValue ->
println("Say '$updatedValue'!")
}
}BroadcastChannel and ConflatedBroadcastChannel were marked as @ObsoleteCoroutinesApi. Users are encouraged to migrate to SharedFlow or StateFlow instead. Please refer to the specific documentation for these classes for the recommended migration path.buffer operator to explicitly adjust the buffer size of any operator that depends on a channel, such as channelFlow, flowOn, or flatMapMerge.