This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Repository navigation
perf(runtime): split UTF-8 messages without per-character encoding - #195
Merged
Merged
Conversation
This was referenced Oct 26, 2026
huanghuoguoguo
marked this pull request as ready for review
October 27, 2026 02:41
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Overview
For normal integer chunk limits of at least four bytes, encode the message once, split at UTF-8 boundaries, and decode each chunk. This avoids encoding every character in Python. Preserve the original greedy chunks and retain the existing path for small/noninteger limits and malformed text, including exception details.
Message/fragment limits, send locks and bounded-executor scheduling remain unchanged. This is independent of event batching and usable by existing Core consumers after an SDK release.
Related: langbot-app/LangBot#2710 (transport cost found during follow-up profiling).
Validation and limits
On this independently split branch:
pytest tests/runtime/io/test_connections.py tests/runtime/io/test_stdio_server.py tests/runtime/io/test_stream_flow_control.py -q: 106 passed, 1 Windows-only test skipped. Includes seeded Unicode equivalence and malformed-input cases. Independent checks covered 16MiB ASCII, Chinese and emoji payloads.A real diagnostic send of approximately 261k characters dropped from 57.38ms to 0.464ms in this helper. This is not a whole-request speedup. The fast path temporarily holds the encoded message; measured allocations for 16MiB inputs peaked around 27–32MiB, excluding the original input.
Combined SQL+UTF-8 ABBA results observed +1.81%/+3.74% throughput but mixed P95; they do not isolate this patch or establish universal tail-latency improvement. Draft pending review and remaining acceptance.
Related review pieces