Skip to content

Commit d811d3a

Browse files
committed
Do not fill in stacktrace in AbortFlowException, update benchmark results
1 parent 78f3e23 commit d811d3a

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

benchmarks/src/jmh/kotlin/benchmarks/flow/misc/Numbers.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ import java.util.concurrent.*
1717
* Results:
1818
*
1919
* // Throw FlowAborted overhead
20-
* Numbers.primes avgt 7 4106.837 ± 59.672 us/op
21-
* Numbers.primesRx avgt 7 2777.232 ± 85.357 us/op
20+
* Numbers.primes avgt 7 3039.185 ± 25.598 us/op
21+
* Numbers.primesRx avgt 7 2677.937 ± 17.720 us/op
2222
*
2323
* // On par
24-
* Numbers.transformations avgt 7 20.290 ± 1.367 us/op
25-
* Numbers.transformationsRx avgt 7 22.932 ± 1.863 us/op
24+
* Numbers.transformations avgt 7 16.207 ± 0.133 us/op
25+
* Numbers.transformationsRx avgt 7 19.626 ± 0.135 us/op
2626
*
2727
* // Channels overhead
28-
* Numbers.zip avgt 7 470.737 ± 10.838 us/op
29-
* Numbers.zipRx avgt 7 104.811 ± 9.073 us/op
28+
* Numbers.zip avgt 7 434.160 ± 7.014 us/op
29+
* Numbers.zipRx avgt 7 87.898 ± 5.007 us/op
3030
*
3131
*/
3232
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)

kotlinx-coroutines-core/common/src/flow/internal/AbortFlowException.kt renamed to kotlinx-coroutines-core/common/src/flow/internal/AbortFlowException.common.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@ import kotlinx.coroutines.*
1010
* This exception is thrown when operator need no more elements from the flow.
1111
* This exception should never escape outside of operator's implementation.
1212
*/
13-
internal class AbortFlowException : CancellationException("Flow was aborted, no more elements needed") {
14-
// TODO expect/actual
15-
// override fun fillInStackTrace(): Throwable = this
16-
}
13+
internal expect class AbortFlowException() : CancellationException
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.coroutines.flow.internal
6+
7+
import kotlinx.coroutines.*
8+
9+
internal actual class AbortFlowException : CancellationException("Flow was aborted, no more elements needed")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.coroutines.flow.internal
6+
7+
import kotlinx.coroutines.*
8+
9+
internal actual class AbortFlowException : CancellationException("Flow was aborted, no more elements needed") {
10+
override fun fillInStackTrace(): Throwable = this
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.coroutines.flow.internal
6+
7+
import kotlinx.coroutines.*
8+
9+
internal actual class AbortFlowException : CancellationException("Flow was aborted, no more elements needed")

0 commit comments

Comments
 (0)