Repository navigation
perf: 大报文优化与归因——自适应发送缓冲 + 三 codec 归因基准 + 大报文指南 - #51
Merged
Merged
Conversation
added 2 commits
August 29, 2026 11:38
- 框架:发送编码缓冲自适应初始尺寸(按连接记忆上一帧高水位,封顶 1MB; 发送 worker 单线程访问无需同步)——稳态尺寸相近的协议不再从 1KB 起 爬几何增长梯子(稳态收益在噪声内,主要消除暖机期的跨桶租借) - 归因基准(64KB,计数消费):byte[] 透传 59–73µs/64KB 分配(框架纯成本 距裸 TCP ≈20–45%,分配仅为解码侧 ToArray);string+span 70–104µs/129KB (+64KB = UTF-16 物化固有税);string+分配式 73–92µs/193KB(再 +64KB = GetBytes 中间数组,span 重载可消除) - 文档:README 双语新增"大报文指南"(span 重载示例/byte[] 消息类型/ 流式编码与自适应缓冲);bench/README 增归因表、端到端表补第三数据点、 框架税 64KB 行加注 codec 主导的归因说明
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.
按确认的三阶段方案执行完毕。
归因结果(核心产出)
64KB 每消息(计数消费、两轮区间):
昨天记录的"64KB 框架税 3–4×"经归因后重新定性:大头是 codec 写法与消息类型成本;发布口径的回显式基准行(134–188µs)已在 bench/README 加注说明其 codec 构成。
框架改动
发送编码缓冲自适应初始尺寸:按连接记忆上一帧高水位(封顶 1MB,发送 worker 单线程无锁)——稳态尺寸相近的协议(设备周期上报)不再从 1KB 起爬几何增长梯子。诚实披露:对稳态大报文的影响在噪声内(收益在暖机期与尺寸混布场景)。
文档
测试
84×3 = 252 全绿(含发送路径全量回归——自适应缓冲改变了起租尺寸,现有发送/会话/混沌测试均覆盖)。