Skip to content

Commit 9b7c03c

Browse files
committed
Increase to default buffer size to 64
1 parent fbaedc4 commit 9b7c03c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

kotlinx-coroutines-core/common/src/channels/Channel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ public interface Channel<E> : SendChannel<E>, ReceiveChannel<E> {
530530
/**
531531
* Requests buffered channel with a default buffer capacity in `Channel(...)` factory function --
532532
* the `ArrayChannel` gets created with a default capacity.
533-
* This capacity is equal to 16 by default and can be overridden by setting
533+
* This capacity is equal to 64 by default and can be overridden by setting
534534
* [DEFAULT_BUFFER_PROPERTY_NAME] on JVM.
535535
*/
536536
public const val BUFFERED = -2
@@ -545,7 +545,7 @@ public interface Channel<E> : SendChannel<E>, ReceiveChannel<E> {
545545
public const val DEFAULT_BUFFER_PROPERTY_NAME = "kotlinx.coroutines.channels.defaultBuffer"
546546

547547
internal val CHANNEL_DEFAULT_CAPACITY = systemProp(DEFAULT_BUFFER_PROPERTY_NAME,
548-
16, 1, UNLIMITED - 1
548+
64, 1, UNLIMITED - 1
549549
)
550550
}
551551
}

kotlinx-coroutines-core/common/test/flow/operators/BufferTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import kotlin.test.*
1111

1212
class BufferTest : TestBase() {
1313
private val n = 50 // number of elements to emit for test
14-
private val defaultBufferSize = 16 // expected default buffer size (per docs)
14+
private val defaultBufferSize = 64 // expected default buffer size (per docs)
1515

1616
// Use capacity == -1 to check case of "no buffer"
1717
private fun checkBuffer(capacity: Int, op: suspend Flow<Int>.() -> Flow<Int>) = runTest {

0 commit comments

Comments
 (0)