Your codex exec is wasting ~900 ms per turn. I measured where.
I spent a weekend rebuilding the JavaScript harness of OpenAI's Codex CLI on Bun. I expected a runtime story. I got an architecture story — and one config line you can use today without touching my fork. The 30-second version Codex is a Rust engine with a thin JavaScript layer on top: an npm launcher, a TypeScript SDK, and a pnpm/jest/tsup toolchain. I swapped that layer to Bun, added a client…
I rebuilt the JavaScript harness of OpenAI's Codex CLI on Bun for a weekend. I expected a runtime improvement, but I discovered an architectural change that could speed up Codex operations. The Codex system is a Rust engine with a thin JavaScript layer on top, including an npm launcher, a TypeScript SDK, and a pnpm/jest/tsup toolchain.
By swapping the JavaScript layer to Bun, adding a client to keep a codex app-server process alive, and measuring with hyperfine and mitata, I found a significant improvement in performance. Specifically, the persistent-process design reduces the time spent per turn from about 900 milliseconds to just 0.31 seconds. This improvement was consistent across both Node.js and Bun runtimes, with Bun providing faster test startup, warm install, and a more efficient JSON-lines parser.
Additionally, the architecture change allowed for better telemetry management, as the process shut down without flushing metrics over HTTPS, thus saving time. The full article provides detailed benchmarks, sequence diagrams, and code demonstrating the performance gains.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.