Codex Code Mode speeds up calls by 10ms via cross-cell tool catalog reuse
Codex 团队的 Charlie Marsh(Ruff 作者)于 11 月 22 日连续发帖,介绍了 Code Mode 的一项执行架构优化:每次调用提速约 10ms。这类调用每天发生大量次数,累积收益可观。
已确认
- 优化核心是在多个 cell 之间复用工具目录(tool catalog):完整的工具列表连同 revision ID 在会话级共享,无需每次重复序列化与传输。
- 执行架构上,每个代码 snippet 都在全新的 V8 isolate 中运行以保证隔离,但承载这些 isolate 的宿主进程是复用的,单轮交互中可连续执行数十段代码。
- Code Mode 的背景约束是模型必须拿到全部可用工具的列表,才能在 JS 代码里调用这些工具;该列表包含每个工具的名称、描述、参数等,可能非常大。
- 旧方案的痛点:每次调用都要对完整工具列表做序列化、发送、反序列化。注册工具很多时,哪怕只是调用 text(1) 这样的简单函数,也要在通道里传输数 MB 数据。
为什么重要
- 这是典型的用架构换性能的案例:通过隔离层(isolate)与复用层(进程、工具目录)的分层设计,在保持安全隔离的同时消除了重复的大数据传输开销,对高频工具调用的编码 agent 提速明显。
2026-11-22 ~ 2026-11-22 · 5 related posts
Primary sources
- Codex Code Mode calls get 10ms faster by reusing tool catalogs across cells — charliermarsh ·
- How Codex Code Mode runs snippets in fresh V8 isolates while reusing one host process — charliermarsh ·
- Dozens of code snippets per turn: fresh V8 isolates plus revision-ID reuse in coding agents — charliermarsh ·
- [source] Codex Code Mode calls get 10ms faster by reusing tool catalogs across cells — charliermarsh · 2026-11-22
- Why Code Mode must expose the full tool list to the model for JS calls — charliermarsh · 2026-11-22
- Before the fix, every Codex Code Mode call shipped multiple MB of tool definitions — charliermarsh · 2026-11-22
- [source] How Codex Code Mode runs snippets in fresh V8 isolates while reusing one host process — charliermarsh · 2026-11-22
- [source] Dozens of code snippets per turn: fresh V8 isolates plus revision-ID reuse in coding agents — charliermarsh · 2026-11-22