#7739·pi

Set a startup-time budget targeting jcode-comparable latency and memory

Author: 1am2symanCreated Aug 6, 2026Updated Sep 27, 2026

What do you want to change?

Set a startup-time budget for pi that targets jcode-comparable latency and memory, and close the gap measured by jcode's README benchmark against pi 0.62.0:

Metric (median; 10 interactive PTY launches, Linux) jcode v0.9.1888-dev pi (same table) Gap
Time to first frame 14.0 ms (10.1–19.3) 590.7 ms (369.6–934.8) 42.2×
Time to first input 48.7 ms (30.3–62.7) 596.4 ms (373.9–955.2) 12.2×
Idle RAM, 1 session (PSS) 27.8 MB 144.4 MB 5.2×
Idle RAM, 10 sessions (PSS) 117.0 MB 833.0 MB 7.1×
Extra RAM per added session ~9.9 MB ~76.5 MB 7.7×

Notes: jcode numbers come from jcode's own README ("Performance & Resource Efficiency"; RAM rows are with local embeddings off). pi 0.62.0 is the version listed in the README's version list for the RAM tables; the timing rows carry no stated version there. Pi's own best measured cold start is 2.55 s (--no-extensions, pi 0.78.0, #5402); ~2.7 s was reported in #7639.

Why?

Startup latency is paid on every spawn, and current pi workflows spawn it constantly:

  • Multiplexer setups (tmux/zellij; pi-mux, dmux) run one pane per session; each switch back pays the first frame plus a ~2.5–2.7 s cold start and multi-second extension reloads (#5905).
  • pi -c one-shots and subagent fan-out multiply the cost: 16 concurrent spawns × 0.59 s ≈ 9.4 s before agents render, and 1000 one-shots at ~2.7 s each total ~45 min. Running many sessions at once also costs ~76.5 MB PSS per session vs ~9.9 MB for jcode.
  • Session resume and switch sit on the same path: listing and parsing session files adds to per-switch latency (#5804, #6594).

Nielsen Norman Group response-time limits put 0.1 s at "instant" and 1.0 s as the limit for uninterrupted flow. jcode's 14 ms first frame sits far below the instant threshold; pi's 590.7 ms and 2.5 s cold start break flow on every spawn. For pane-per-session workflows, spawn speed decides whether multiplexers feel like background processes or warm tabs.

This builds on prior work rather than duplicating it: #7639 (startup benchmark, closed no-action), #6530 (Node CLI startup cost, unmerged), #5402/#5405 (138 MB eager provider SDK loads), #5380/#6892 (extension transpile cost), #2522 (bundled entrypoint), #5804/#6594 (fast session load). The ask is a jcode-parity budget on top of those.

How? (optional)

  • Add the CI startup gate #7639 proposed: benchmark cold start and TUI first frame with a hard budget — e.g. first frame < 150 ms, or a 4× improvement over the current baseline — measured like jcode's README (10 interactive launches).
  • Lazy-load the remaining eager work: provider SDKs at top level (#5402/#5405), jiti extension transpilation with a persistent disk cache (#5380/#6892), sequential package resolution.
  • Investigate an entrypoint that skips the Node bootstrap path where possible: bundled single-file CLI (#2522) and fast paths for version/RPC (#6530), working toward a compiled artifact like jcode's Rust binary.