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

Increase AsyncStream and Transport default buffer size from 4096 to 16384. #506

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion chronos/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ const
chronosHasRaises* = 0
## raises effect support via `async: (raises: [])`

chronosTransportDefaultBufferSize* {.intdefine.} = 16384
## Default size of chronos transport internal buffer.

chronosStreamDefaultBufferSize* {.intdefine.} = 16384
## Default size of chronos async stream internal buffer.

when defined(chronosStrictException):
{.warning: "-d:chronosStrictException has been deprecated in favor of handleException".}
# In chronos v3, this setting was used as the opposite of
Expand All @@ -113,7 +119,10 @@ when defined(debug) or defined(chronosConfig):
printOption("chronosEventEngine", chronosEventEngine)
printOption("chronosEventsCount", chronosEventsCount)
printOption("chronosInitialSize", chronosInitialSize)

printOption("chronosTransportDefaultBufferSize",
chronosTransportDefaultBufferSize)
printOption("chronosStreamDefaultBufferSize",
chronosStreamDefaultBufferSize)

# In nim 1.6, `sink` + local variable + `move` generates the best code for
# moving a proc parameter into a closure - this only works for closure
Expand Down
6 changes: 3 additions & 3 deletions chronos/streams/asyncstream.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

{.push raises: [].}

import ../asyncloop, ../asyncsync
import ../transports/common, ../transports/stream
import ../[config, asyncloop, asyncsync]
import ../transports/[common, stream]
export asyncloop, asyncsync, stream, common

const
AsyncStreamDefaultBufferSize* = 4096
AsyncStreamDefaultBufferSize* = chronosStreamDefaultBufferSize
## Default reading stream internal buffer size.
AsyncStreamDefaultQueueSize* = 0
## Default writing stream internal queue size.
Expand Down
10 changes: 5 additions & 5 deletions chronos/transports/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import std/[strutils]
import stew/[base10, byteutils]
import ".."/[asyncloop, osdefs, oserrno, handles]
import ".."/[config, asyncloop, osdefs, oserrno, handles]

from std/net import Domain, `==`, IpAddress, IpAddressFamily, parseIpAddress,
SockType, Protocol, Port, `$`
Expand All @@ -21,10 +21,10 @@ export Domain, `==`, IpAddress, IpAddressFamily, parseIpAddress, SockType,
Protocol, Port, toInt, `$`

const
DefaultStreamBufferSize* = 4096 ## Default buffer size for stream
## transports
DefaultDatagramBufferSize* = 65536 ## Default buffer size for datagram
## transports
DefaultStreamBufferSize* = chronosTransportDefaultBufferSize
## Default buffer size for stream transports
DefaultDatagramBufferSize* = 65536
## Default buffer size for datagram transports
type
ServerFlags* = enum
## Server's flags
Expand Down
Loading