Repository navigation
sync: reduce write calls and reuse the send buffer - #337
Merged
Merged
Conversation
Apply the bounded coalescing used by the async writer in #327 and the buffer reuse from #328 to both sync sending threads. Combine the header and payload prefix in a reusable buffer capped at 4 KiB. Write the rest of large payloads directly, preserve short-write handling, and reject zero writes instead of looping indefinitely. Add tests for write counts, frame boundaries, reuse, write failures, and Unix socket round trips. Signed-off-by: Tim Zhang <[email protected]>
teawater
approved these changes
Oct 8, 2026
There was a problem hiding this comment.
🟢 Approval recommended
The implementation preserves wire behavior, handles partial and zero writes correctly, and has focused coverage for the new send path.
0 open findings
What changed in this PR
Ports bounded, reusable send-buffer optimizations to the synchronous transport while preserving framing and short-write handling.
Changes:
- Coalesces headers with up to 4 KiB of payload.
- Reuses sender-thread buffers.
- Adds boundary, failure, reuse, and Unix socket tests.
| File | Description |
|---|---|
src/sync/channel.rs |
Implements optimized frame writes and tests. |
src/sync/client.rs |
Reuses a client sender buffer. |
src/sync/server.rs |
Reuses each server response buffer. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
lifupan
approved these changes
Oct 8, 2026
Tim-Zhang
added a commit
that referenced
this pull request
Oct 8, 2026
Include the sync send-path optimization from PR #337 in release notes. Direct migration readers to changelogs and keep the release process independent of the current release versions. Signed-off-by: Tim Zhang <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port the async send-path optimizations from #327 and #328 to sync.
Linux validation passed: workspace tests including examples, rustprotobuf/prost unit and security-extension integration tests, formatting, Clippy with warnings denied, and Rust 1.80 sync tests with both codecs. Windows/macOS and RunD end-to-end performance were not tested.