Skip to content

[Lynx M1] 按真机归因削减 transport 重复遍历、JSON 与 ACK 成本 #285

Closed

Description

@Huxpro

总路线:#282(承接 #281)。所属 milestone:Lynx ceiling M1 — 消除 bulk create 的架构残差。

必须纠正的前提

当前 codec 已发送 JSON.stringify([flags,payload]) 字符串;接收 decode 已用 JSON.parse,flags=0 无 JS restore walk。#281/#278 中“改成单字符串 JSON”的建议不是新的候选方案。

依赖与决策

先完成 #278(含源代码校正)与 #283。分别归因 prepare、stringify、桥队列/复制、parse、escaped restore、checked/trusted validation、ACK 构造/编码/应用及 GC。首屏 engine lifecycle 的 localizeLynxHostValue 另列,不混成 steady transport decode。

按实测选择一个最小机制:

  • 重复 sender traversal/alias expansion 占主要成本:让编译器/producer 保留一次构造的已知值域证明或更紧凑的 run 数据,仍在边界拒绝非法值;缓存必须有不可变性、失效与生命周期证明。
  • 校验为 owner:先测已存在的 checked/trusted 开关;只在双线程同一可信构建契约成立时考虑生产集成,dev 完整检查与协议 envelope/身份/版本等关键校验保留。该开关不得掩盖 arity 错配。
  • JSON 字节/解析/GC 为 owner:再比较 schema-specific flat payload、减少重复值、或引擎明确支持的 binary/typed-array。binary 只在 target capability 验证后进入产品候选,不假定零复制。

若本层没有可压缩 owner,交付有证据的 no-change 结论并让主线转向 BTS/MTS;不能为了 issue 有 diff 而替换 wire。

验收

receiver-local invariant 不变;undefined/缺失键、NUL sentinel、proto、循环/深度、非法数字/对象、拒绝/取消和版本错配语义保持。数据传输至少 Ω(变化值大小),结构消息只随 runs/programs 增长;clear/recreate 多周期验证 compact ACK 不重新膨胀。热路径 CPU/临时分配下降且 end-to-end 有可辨收益,另一方向的 ACK/启动不退化;仅缩短 encode 但延后到 apply 不算收益。

通用合并与证据契约

  • 保持 Octane 的 hooks、refs/effects、原生事件、Suspense/Activity/portal、reject/abort 与 cleanup 语义;适用模式必须覆盖。共享两条路径时使用同一语义实现,并加独立的用户可观察断言,不能只做 differential 对比。
  • 每个优化 PR 带 baseline/candidate 的精确 SHA、生产 bundle hash、机制命中/回退原因、同窗口 AB/BA 原始样本及成本归属;profile 负责解释,未插桩生产产物负责 headline。未测到的收益标为 hypothesis。
  • 先拿到相关 owner 数据,再实现一个机制一条 PR;正确性与 current-head CI 通过才算交付。记录对冷启动、另一线程、GC、内存和 bundle 的成本转移。

由 agent 根据 #281 的后续规划请求创建。

Activity

  1. Huxpro commented on Sep 7, 2026

    @Huxpro
    OwnerAuthor

    #294 closes this layer with an evidence-backed no-change decision. The shipping commit path was measured directly on aries_10: prepare/stringify exponent 0.954, encode 1.011, wire 1.004; 15/15 checked commits used flags=0 with zero receiver restore time; checked/trusted controls were effectively identical (approximately 0.999/1.000/0.996).

    Meanwhile MTS apply owns 96.4% of paired 1k control wall and scales at exponent 1.952. Replacing the existing JSON-string wire, weakening validation, or adding a cache here would move complexity without a measurable owner. No transport product diff is justified. Evidence/report: #294; merged head dc42bdd513d58b026c576f76a013231cdbff8e09.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-authoredenhancementlynx

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions