Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

perf(runtime): split UTF-8 messages without per-character encoding - #195

Merged
huanghuoguoguo merged 1 commit into
mainfrom
perf/utf8-chunk-encoding
Oct 27, 2026
Merged

huanghuoguoguo merged 1 commit into
mainfrom
perf/utf8-chunk-encoding

Conversation

@huanghuoguoguo

@huanghuoguoguo huanghuoguoguo commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

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

@huanghuoguoguo
huanghuoguoguo marked this pull request as ready for review October 27, 2026 02:41
@huanghuoguoguo
huanghuoguoguo merged commit 0124220 into main Oct 27, 2026
8 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T02:41:46.575860Z b6ea8cd Draft marked ready
🔒 Security Review 🔄 Running since 2026-10-27T02:41:46.854395Z b6ea8cd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant