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

set tcpNoDelay option on all sockets for 100x speedup #109

Merged
merged 1 commit into from
Oct 21, 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
2 changes: 2 additions & 0 deletions pkgs/_macro_client/lib/macro_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class MacroClient {
final Map<int, Completer<Response>> _responseCompleters = {};

MacroClient._(this.macros, this.socket) {
// Nagle's algorithm slows us down >100x, disable it.
socket.setOption(SocketOption.tcpNoDelay, true);
_host = RemoteMacroHost(this);
_start();
}
Expand Down
5 changes: 4 additions & 1 deletion pkgs/_macro_server/lib/macro_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ class _Connection {
/// Responses to query requests from the macro.
Stream<Response> get responses => _responsesController.stream;

_Connection(this.socket);
_Connection(this.socket) {
// Nagle's algorithm slows us down >100x, disable it.
socket.setOption(SocketOption.tcpNoDelay, true);
}

@override
String toString() => '_Connection($descriptions)';
Expand Down