Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.3.4 #1846

Merged
merged 52 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
24f5f9c
Better diagnostics on ChannelSelectStressTest failure
elizarov Dec 13, 2019
8a6e8d1
Merge branch 'master' into develop
qwwdfsad Dec 16, 2019
cc3d8c4
update `broadcastIn` comment to refer to itself instead of `produce`
Dec 16, 2019
f8b3c44
Fix TestBase example in kdoc
mareklangiewicz Dec 14, 2019
476d6de
Authenticate in 'kotlin-dev' repo on Bintray
Dec 16, 2019
60f8688
Use common SharedImmutable declaration from stdlib
elizarov Dec 17, 2019
12a0318
Use common ThreadLocal declaration from stdlib
elizarov Dec 19, 2019
70e3583
Make CoroutinesDumpTest deterministic
qwwdfsad Dec 25, 2019
c526c3f
Do not request additional worker from 'yield' calls and during post-e…
qwwdfsad Dec 25, 2019
c5e6e03
Generate site using Jekyll via Docker
elizarov Dec 25, 2019
16d2606
Site building docs updated
elizarov Dec 25, 2019
1f77783
Fix non-linearizability in `ArrayChannel` while moving an element fro…
ndkoval Dec 25, 2019
4f24a7a
Update lincheck to 2.5.3 and re-write the corresponding tests
ndkoval Nov 12, 2019
fe15b6d
Flow.flattenMerge benchmark (#1464)
fmixing Dec 26, 2019
345458b
ReceiveChannel.receiveAsFlow extension (#1731)
elizarov Dec 26, 2019
f18e0e4
Merge branch 'master' into develop
qwwdfsad Jan 15, 2020
3d59fef
Fix context support in Publisher.asFlow.flowOn
elizarov Jan 21, 2020
642989e
Disable companions test in binary-compatibility-validation in train b…
qwwdfsad Jan 24, 2020
6810745
Request elements in batches in ReactiveFlow to avoid requesting eleme…
qwwdfsad Jan 27, 2020
fb990b0
Disable CasesPublicAPITest completely for train builds
qwwdfsad Feb 4, 2020
cf5da1a
Remove extraneous word in comment
EricAtPlanGrid Feb 4, 2020
09cb4bf
Fix tests hanging when `verifyDump` fails
dkhalanskyjb Feb 4, 2020
e153863
Integration with binary-compatibility-validator plugin (#1790)
qwwdfsad Feb 10, 2020
387d1dd
Improve test style
dkhalanskyjb Feb 10, 2020
91e4d77
Fix failing publication validation
dkhalanskyjb Feb 11, 2020
90a9faf
Update module name for kotlinx-coroutines-core-common artifact
elizarov Feb 12, 2020
0126dba
ConflatedChannel with lock to protect the one-element buffer, double-…
mvicsokolova Nov 25, 2019
4aa3880
Detect missing awaitClose calls in callbackFlow and close channel wit…
qwwdfsad Feb 13, 2020
b64a23b
Improve FieldWalker, don't access JDK classes (#1799)
elizarov Feb 13, 2020
de491d2
Make SafeCollector platform-specific declaration and enforce exceptio…
qwwdfsad Feb 13, 2020
9f4fd70
Fix a race in some tests for JavaRX integration (#1801)
dkhalanskyjb Feb 13, 2020
455c255
Introduce ExecutorRule for stress-tests for simpler development process
qwwdfsad Feb 13, 2020
1ed6fcc
Indicate that root README should be updated with new contributions (#…
MariusVolkhart Feb 13, 2020
660c2d7
Use a separate Knit tool (#1486)
elizarov Feb 14, 2020
1ac3dc2
Build project using JDK 11 (#1733)
elizarov Feb 14, 2020
bf9509d
Optimize the size of the coroutines library in Android projects (#1282)
elizarov Feb 14, 2020
6d1a6e3
Update copyright year
qwwdfsad Feb 18, 2020
3651276
Make publication validator part of the project (#1820)
dkhalanskyjb Feb 21, 2020
21bb6fb
Temporary workaround bug in K/N 1.3.70 codegen (KT-37061)
qwwdfsad Feb 26, 2020
d4fabbf
Fixed regularized 'when' inference to build train
elizarov Mar 3, 2020
ca1093c
Restore AsyncJvmTest
qwwdfsad Mar 3, 2020
4a53d23
Atomically start coroutines in intermediate Flow operators in order t…
qwwdfsad Mar 3, 2020
cf473d2
Kotlin 1.3.70 (#1837)
elizarov Mar 4, 2020
c684d04
Knit version 0.1.3 (#1838)
elizarov Mar 4, 2020
6862afc
Simpler and faster lock-free linked list (#1565)
elizarov Mar 4, 2020
12e96cd
Implement ObservableValue<T>.asFlow() (#1789)
dkhalanskyjb Mar 4, 2020
d831a86
Add ObservableSource.asFlow operator (#1768)
mareklangiewicz Feb 23, 2020
8d8a8fb
Reuse RxJava built-in disposed Disposable (#1841)
qwwdfsad Mar 4, 2020
214f156
Leverage polymorphic keys un CoroutineDispatcher and ExecutorCoroutin…
qwwdfsad Mar 5, 2020
c67aed0
Migrate experimental annotations to new API and provide custom warnin…
qwwdfsad Mar 5, 2020
7df61ee
Fixed memory leak on a race between adding/removing from lock-free li…
elizarov Mar 6, 2020
bb3cf09
Version 1.3.4
qwwdfsad Mar 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change log for kotlinx.coroutines

## Version 1.3.4

### Flow

* Detect missing `awaitClose` calls in `callbackFlow` to make it less error-prone when used with callbacks (#1762, #1770). This change makes `callbackFlow` **different** from `channelFlow`.
* `ReceiveChannel.asFlow` extension is introduced (#1490).
* Enforce exception transparency invariant in `flow` builder (#1657).
* Proper `Dispatcher` support in `Flow` reactive integrations (#1765).
* Batch `Subscription.request` calls in `Flow` reactive integration (#766).
* `ObservableValue.asFlow` added to JavaFx integration module (#1695).
* `ObservableSource.asFlow` added to RxJava2 integration module (#1768).

### Other changes

* `kotlinx-coroutines-core` is optimized for R8, making it much smaller for Android usages (75 KB for `1.3.4` release).
* Performance of `Dispatchers.Default` is improved (#1704, #1706).
* Kotlin is updated to 1.3.70.
* `CoroutineDispatcher` and `ExecutorCoroutineDispatcher` experimental coroutine context keys are introduced (#1805).
* Performance of various `Channel` operations is improved (#1565).

## Version 1.3.3

### Flow
Expand Down
40 changes: 22 additions & 18 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.3) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.3)
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.4) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.4)

Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
This is a companion version for Kotlin `1.3.61` release.
This is a companion version for Kotlin `1.3.70` 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.3</version>
<version>1.3.4</version>
</dependency>
```

And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.3.61</kotlin.version>
<kotlin.version>1.3.70</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.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4'
}
```

And make sure that you use the latest Kotlin version:

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

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.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4")
}
```

And make sure that you use the latest Kotlin version:

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

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.3/jar)
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.4/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.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'
```

This gives you access to Android [Dispatchers.Main]
Expand All @@ -164,24 +164,21 @@ threads are handled by Android runtime.

#### R8 and ProGuard

For R8 no actions required, it will take obfuscation rules from the jar.

For Proguard you need to add options from [coroutines.pro](kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro) to your rules manually.

R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default since Android gradle plugin 3.4.0 (3.3.0-beta also had it enabled).
R8 and ProGuard rules are bundled into the [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android) module.
For more details see ["Optimization" section for Android](ui/kotlinx-coroutines-android/README.md#optimization).

### 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.3/jar)
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.4/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.3/jar)
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.4/jar)
(follow the link to get the dependency declaration snippet).

Only single-threaded code (JS-style) on Kotlin/Native is currently supported.
Expand All @@ -203,8 +200,9 @@ to Gradle (in Preferences -> Build, Execution, Deployment -> Build Tools -> Grad

### Requirements

* JDK >= 1.8 referred to by the `JAVA_HOME` environment variable. JDK must include JavaFX.
* JDK >= 11 referred to by the `JAVA_HOME` environment variable.
* JDK 1.6 referred to by the `JDK_16` environment variable. It is okay to have `JDK_16` pointing to `JAVA_HOME` for external contributions.
* JDK 1.8 referred to by the `JDK_18` environment variable. Only used by nightly stress-tests. It is okay to have `JDK_16` pointing to `JAVA_HOME` for external contributions.

## Contributions and releases

Expand All @@ -217,6 +215,12 @@ The `develop` branch is pushed to `master` during release.

* Full release procedure checklist is [here](RELEASE.md).
* Steps for contributing new integration modules are explained [here](integration/README.md#Contributing).
* Use [Knit](https://github.com/Kotlin/kotlinx-knit/blob/master/README.md) for updates to documentation:
* In project root directory run `./gradlew knit`.
* Commit updated documents and examples together with other changes.
* Use [Binary Compatibility Validator](https://github.com/Kotlin/binary-compatibility-validator/blob/master/README.md) for updates to public API:
* In project root directory run `./gradlew apiDump`.
* Commit updated API index together with other changes.

<!--- MODULE kotlinx-coroutines-core -->
<!--- INDEX kotlinx.coroutines -->
Expand Down
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ To release new `<version>` of `kotlinx-coroutines`:
* Create a release named `<version>`.
* Cut & paste lines from [`CHANGES.md`](CHANGES.md) into description.

3. Build and publish documentation for web-site: <br>
3. Build and publish documentation for web-site
(make sure you have [Docker](https://www.docker.com/) installed first): <br>
`site/deploy.sh <version> push`

4. In [Bintray](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines) admin interface:
Expand Down
4 changes: 3 additions & 1 deletion benchmarks/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -74,4 +74,6 @@ dependencies {
compile "org.openjdk.jmh:jmh-core:1.21"
compile 'com.typesafe.akka:akka-actor_2.12:2.5.0'
compile project(':kotlinx-coroutines-core')
// add jmh dependency on main
jmh sourceSets.main.runtimeClasspath
}
75 changes: 75 additions & 0 deletions benchmarks/scripts/generate_plots_flow_flatten_merge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# To run this script run the command 'python3 scripts/generate_plots_flow_flatten_merge.py' in the /benchmarks folder


import pandas as pd
import sys
import locale
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter

input_file = "build/reports/jmh/results.csv"
output_file = "out/flow-flatten-merge.svg"
# Please change the value of this variable according to the FlowFlattenMergeBenchmarkKt.ELEMENTS
elements = 100000
benchmark_name = "benchmarks.flow.FlowFlattenMergeBenchmark.flattenMerge"
csv_columns = ["Benchmark", "Score", "Unit", "Param: concurrency", "Param: flowsNumberStrategy"]
rename_columns = {"Benchmark": "benchmark", "Score" : "score", "Unit" : "unit",
"Param: concurrency" : "concurrency", "Param: flowsNumberStrategy" : "flows"}

markers = ['.', 'v', '^', '1', '2', '8', 'p', 'P', 'x', 'D', 'd', 's']
colours = ['red', 'gold', 'sienna', 'olivedrab', 'lightseagreen', 'navy', 'blue', 'm', 'crimson', 'yellow', 'orangered', 'slateblue', 'aqua', 'black', 'silver']

def next_colour():
i = 0
while True:
yield colours[i % len(colours)]
i += 1

def next_marker():
i = 0
while True:
yield markers[i % len(markers)]
i += 1

def draw(data, plt):
plt.xscale('log', basex=2)
plt.gca().xaxis.set_major_formatter(FormatStrFormatter('%0.f'))
plt.grid(linewidth='0.5', color='lightgray')
if data.unit.unique()[0] != "ops/s":
print("Unexpected time unit: " + data.unit.unique()[0])
sys.exit(1)
plt.ylabel("elements / ms")
plt.xlabel('concurrency')
plt.xticks(data.concurrency.unique())

colour_gen = next_colour()
marker_gen = next_marker()
for flows in data.flows.unique():
gen_colour = next(colour_gen)
gen_marker = next(marker_gen)
res = data[(data.flows == flows)]
# plt.plot(res.concurrency, res.score*elements/1000, label="flows={}".format(flows), color=gen_colour, marker=gen_marker)
plt.errorbar(x=res.concurrency, y=res.score*elements/1000, yerr=res.score_error*elements/1000, solid_capstyle='projecting',
label="flows={}".format(flows), capsize=4, color=gen_colour, linewidth=2.2)

langlocale = locale.getdefaultlocale()[0]
locale.setlocale(locale.LC_ALL, langlocale)
dp = locale.localeconv()['decimal_point']
if dp == ",":
csv_columns.append("Score Error (99,9%)")
rename_columns["Score Error (99,9%)"] = "score_error"
elif dp == ".":
csv_columns.append("Score Error (99.9%)")
rename_columns["Score Error (99.9%)"] = "score_error"
else:
print("Unexpected locale delimeter: " + dp)
sys.exit(1)
data = pd.read_csv(input_file, sep=",", decimal=dp)
data = data[csv_columns].rename(columns=rename_columns)
data = data[(data.benchmark == benchmark_name)]
plt.rcParams.update({'font.size': 15})
plt.figure(figsize=(12.5, 10))
draw(data, plt)
plt.legend(loc='upper center', borderpad=0, bbox_to_anchor=(0.5, 1.3), ncol=2, frameon=False, borderaxespad=2, prop={'size': 15})
plt.tight_layout(pad=12, w_pad=2, h_pad=1)
plt.savefig(output_file, bbox_inches='tight')
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.flow.scrabble;
Expand Down Expand Up @@ -160,4 +160,4 @@ public List<Entry<Integer, List<String>>> play() throws Exception {
.blockingGet() ;
return finalList2 ;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.flow.scrabble;
Expand Down Expand Up @@ -171,4 +171,4 @@ public List<Entry<Integer, List<String>>> play() throws Exception {

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

package benchmarks.flow.scrabble.optimizations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.flow.scrabble.optimizations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks.flow.scrabble.optimizations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks
Expand Down Expand Up @@ -147,4 +147,4 @@ private fun doWork(): Unit = Blackhole.consumeCPU(ThreadLocalRandom.current().ne

private const val WORK_MIN = 50L
private const val WORK_MAX = 100L
private const val APPROX_BATCH_SIZE = 100000
private const val APPROX_BATCH_SIZE = 100000
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package benchmarks
Expand Down Expand Up @@ -44,4 +44,4 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {
closeable?.close()
}

}
}