Skip to content

Commit

Permalink
Merge pull request Kotlin#1703 from Kotlin/version-1.3.3
Browse files Browse the repository at this point in the history
Version 1.3.3
  • Loading branch information
qwwdfsad committed Dec 13, 2019
2 parents 344e932 + efc234f commit 99b78e4
Show file tree
Hide file tree
Showing 281 changed files with 6,779 additions and 4,040 deletions.
43 changes: 43 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Change log for kotlinx.coroutines

## Version 1.3.3

### Flow
* `Flow.take` performance is significantly improved (#1538).
* `Flow.merge` operator (#1491).
* Reactive Flow adapters are promoted to stable API (#1549).
* Reusable cancellable continuations were introduced that improved the performance of various flow operators and iteration over channels (#1534).
* Fixed interaction of multiple flows with `take` operator (#1610).
* Throw `NoSuchElementException` instead of `UnsupportedOperationException` for empty `Flow` in `reduce` operator (#1659).
* `onCompletion` now rethrows downstream exceptions on emit attempt (#1654).
* Allow non-emitting `withContext` from `flow` builder (#1616).

### Debugging

* `DebugProbes.dumpCoroutines` is optimized to be able to print the 6-digit number of coroutines (#1535).
* Properly capture unstarted lazy coroutines in debugger (#1544).
* Capture coroutines launched from within a test constructor with `CoroutinesTimeout` test rule (#1542).
* Stacktraces of `Job`-related coroutine machinery are shortened and prettified (#1574).
* Stacktrace recovery unification that should provide a consistent experience recover of stacktrace (#1597).
* Stacktrace recovery for `withTimeout` is supported (#1625).
* Do not recover exception with a single `String` parameter constructor that is not a `message` (#1631).

### Other features

* `Dispatchers.Default` and `Dispatchers.IO` rework: CPU consumption is significantly lower, predictable idle threads termination (#840, #1046, #1286).
* Avoid `ServiceLoader` for loading `Dispatchers.Main` (#1572, #1557, #878, #1606).
* Consistently handle undeliverable exceptions in RxJava and Reactor integrations (#252, #1614).
* `yield` support in immediate dispatchers (#1474).
* `CompletableDeferred.completeWith(result: Result<T>)` is introduced.
* Added support for tvOS and watchOS-based Native targets (#1596).

### Bug fixes and improvements

* Kotlin version is updated to 1.3.61.
* `CoroutineDispatcher.isDispatchNeeded` is promoted to stable API (#1014).
* Livelock and stackoverflows in mutual `select` expressions are fixed (#1411, #504).
* Properly handle `null` values in `ListenableFuture` integration (#1510).
* Making ReceiveChannel.cancel linearizability-friendly.
* Linearizability of Channel.close in a complex contended cases (#1419).
* ArrayChannel.isBufferEmpty atomicity is fixed (#1526).
* Various documentation improvements.
* Reduced bytecode size of `kotlinx-coroutines-core`, reduced size of minified `dex` when using basic functionality of `kotlinx-coroutines`.

## Version 1.3.2

This is a maintenance release that does not include any new features or bug fixes.
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.2) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.2)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.3) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.3)

Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
This is a companion version for Kotlin `1.3.50` release.
This is a companion version for Kotlin `1.3.61` release.

```kotlin
suspend fun main() = coroutineScope {
Expand Down Expand Up @@ -82,15 +82,15 @@ Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
</dependency>
```

And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.3.50</kotlin.version>
<kotlin.version>1.3.61</kotlin.version>
</properties>
```

Expand All @@ -100,15 +100,15 @@ Add dependencies (you can also add other modules that you need):

```groovy
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
}
```

And make sure that you use the latest Kotlin version:

```groovy
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
}
```

Expand All @@ -126,15 +126,15 @@ Add dependencies (you can also add other modules that you need):

```groovy
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
}
```

And make sure that you use the latest Kotlin version:

```groovy
plugins {
kotlin("jvm") version "1.3.50"
kotlin("jvm") version "1.3.61"
}
```

Expand All @@ -145,7 +145,7 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
Core modules of `kotlinx.coroutines` are also available for
[Kotlin/JS](#js) and [Kotlin/Native](#native).
In common code that should get compiled for different platforms, add dependency to
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.2/jar)
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.3/jar)
(follow the link to get the dependency declaration snippet).

### Android
Expand All @@ -154,7 +154,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
module as dependency when using `kotlinx.coroutines` on Android:

```groovy
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
```

This gives you access to Android [Dispatchers.Main]
Expand All @@ -173,15 +173,15 @@ R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default
### JS

[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.2/jar)
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.3/jar)
(follow the link to get the dependency declaration snippet).

You can also use [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) package via NPM.

### Native

[Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html) version of `kotlinx.coroutines` is published as
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.2/jar)
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.3/jar)
(follow the link to get the dependency declaration snippet).

Only single-threaded code (JS-style) on Kotlin/Native is currently supported.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks

import kotlinx.coroutines.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package benchmarks

import benchmarks.actors.CORES_COUNT
import benchmarks.akka.CORES_COUNT
import kotlinx.coroutines.*
import kotlinx.coroutines.scheduling.*
import org.openjdk.jmh.annotations.Param
Expand All @@ -22,14 +22,14 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {

abstract var dispatcher: String
override lateinit var coroutineContext: CoroutineContext
var closeable: Closeable? = null
private var closeable: Closeable? = null

@UseExperimental(InternalCoroutinesApi::class)
@Setup
@UseExperimental(InternalCoroutinesApi::class)
open fun setup() {
coroutineContext = when {
dispatcher == "fjp" -> ForkJoinPool.commonPool().asCoroutineDispatcher()
dispatcher == "experimental" -> {
dispatcher == "scheduler" -> {
ExperimentalCoroutineDispatcher(CORES_COUNT).also { closeable = it }
}
dispatcher.startsWith("ftp") -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.actors
package benchmarks.akka

import akka.actor.ActorRef
import akka.actor.ActorSystem
Expand All @@ -13,7 +13,6 @@ import org.openjdk.jmh.annotations.*
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit

const val N_MESSAGES = 100_000

Expand All @@ -29,12 +28,12 @@ class Stop
* PingPongAkkaBenchmark.singlePingPong default-dispatcher avgt 10 173.742 ± 41.984 ms/op
* PingPongAkkaBenchmark.singlePingPong single-thread-dispatcher avgt 10 24.181 ± 0.730 ms/op
*/
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(value = 2)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
//@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
//@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
//@Fork(value = 2)
//@BenchmarkMode(Mode.AverageTime)
//@OutputTimeUnit(TimeUnit.MILLISECONDS)
//@State(Scope.Benchmark)
open class PingPongAkkaBenchmark {

lateinit var system: ActorSystem
Expand Down Expand Up @@ -62,12 +61,12 @@ open class PingPongAkkaBenchmark {
Await.ready(system.terminate(), Duration.Inf())
}

@Benchmark
// @Benchmark
fun singlePingPong() {
runPingPongs(1)
}

@Benchmark
// @Benchmark
fun coresCountPingPongs() {
runPingPongs(Runtime.getRuntime().availableProcessors())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.actors
package benchmarks.akka

import akka.actor.ActorRef
import akka.actor.ActorSystem
Expand All @@ -14,7 +14,6 @@ import scala.concurrent.Await
import scala.concurrent.duration.Duration
import java.util.concurrent.CountDownLatch
import java.util.concurrent.ThreadLocalRandom
import java.util.concurrent.TimeUnit

const val ROUNDS = 10_000
const val STATE_SIZE = 1024
Expand All @@ -38,12 +37,12 @@ val CORES_COUNT = Runtime.getRuntime().availableProcessors()
* StatefulActorAkkaBenchmark.singleComputationSingleRequestor default-dispatcher avgt 14 39.964 ± 2.343 ms/op
* StatefulActorAkkaBenchmark.singleComputationSingleRequestor single-thread-dispatcher avgt 14 10.214 ± 2.152 ms/op
*/
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(value = 2)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
//@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
//@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
//@Fork(value = 2)
//@BenchmarkMode(Mode.AverageTime)
//@OutputTimeUnit(TimeUnit.MILLISECONDS)
//@State(Scope.Benchmark)
open class StatefulActorAkkaBenchmark {

lateinit var system: ActorSystem
Expand Down Expand Up @@ -72,22 +71,22 @@ open class StatefulActorAkkaBenchmark {
Await.ready(system.terminate(), Duration.Inf())
}

@Benchmark
// @Benchmark
fun singleComputationSingleRequestor() {
run(1, 1)
}

@Benchmark
// @Benchmark
fun singleComputationMultipleRequestors() {
run(1, CORES_COUNT)
}

@Benchmark
// @Benchmark
fun multipleComputationsSingleRequestor() {
run(CORES_COUNT, 1)
}

@Benchmark
// @Benchmark
fun multipleComputationsMultipleRequestors() {
run(CORES_COUNT, CORES_COUNT)
}
Expand Down Expand Up @@ -120,7 +119,8 @@ open class StatefulActorAkkaBenchmark {

private fun createComputationActors(initLatch: CountDownLatch, count: Int): List<ActorRef> {
return (0 until count).map {
system.actorOf(Props.create(ComputationActor::class.java,
system.actorOf(Props.create(
ComputationActor::class.java,
LongArray(STATE_SIZE) { ThreadLocalRandom.current().nextLong(0, 100) }, initLatch)
.withDispatcher("akka.actor.$dispatcher"))
}
Expand Down
Loading

0 comments on commit 99b78e4

Please sign in to comment.