perf(statusline): build ctx once per run instead of once per script #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "guochao/agent-run:perf-statusline-hoist-context"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
build_context_table runs
git rev-parse+git status --porcelain,which was called on every iteration of the parts loop. In huge repos
like Chromium each call costs ~3s, so the 8-script loop took ~24s when
cwd was heavy. The static fields (stdin, env, cwd, git) don't vary
across scripts, so hoist the call to before the loop. Cuts git
subprocess invocations from 2*N to 2, total wall time from ~86ms to
~20ms in this repo, and from ~24s to ~3s in Chromium.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com