Skip to content

perf(tui): avoid repeated skill discovery before the first frame - #364

Merged
daviddanialy merged 2 commits into
mainfrom
perf/tui-launch-first-frame
Dec 1, 2026
Merged

daviddanialy merged 2 commits into
mainfrom
perf/tui-launch-first-frame

Conversation

@daviddanialy

@daviddanialy daviddanialy commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Change

Configure compose before attaching its live child registry and format the catalog already enumerated by the builder. Derive skill names and descriptions from the same discovery pass. Permission checks, live refreshes, and invocation still consult current tools. On Unix, read already-queued terminal capability replies without polling before every byte. No work is deferred until the first keystroke.

End-to-end release benchmark

macOS arm64; unmodified 315557c vs this branch. From launching the real TUI process through the completed first frame containing the selected model and ready message editor; includes ACP child launch, session creation, model discovery and terminal negotiation. Fresh isolated HOME/workspace and a loopback OpenRouter catalog on each launch. One warm-up pair, then 15 alternating pairs per scenario; medians:

Workspace skills Before After Change
0 94.44 ms 94.77 ms No measurable improvement
10 98.15 ms 92.69 ms 5.6% less time
50 141.86 ms 101.89 ms 28.2% less time
100 167.72 ms 108.99 ms 35.0% less time
250 294.89 ms 134.50 ms 54.4% less time
500 522.85 ms 160.68 ms 69.3% less time
1,000 880.13 ms 236.01 ms 73.2% less time

At 1,000 skills the editor was ready 644 ms sooner (3.7× as fast).

Reproduce with the one-off benchmark script at the measured commit: python3 benchmark-tui-launch.py /path/to/base/kit /path/to/candidate/kit --skills 50 --runs 15. This isolates local launch costs, not production provider/network latency; individual runs vary.

Validation

Focused runtime/compose/skill tests (including catalog parity and skill changes after startup), 9 terminal-probe tests and 7 startup-picker integration tests passed. Formatting and diff checks passed.

Behavior check at 1,000 skills: Captured the first provider request from both release binaries against a local test server. Their tools fields were identical, including tool descriptions and schemas, and all 1,000 generated skill names were present. A separate regression test confirms that a skill added after startup is still advertised and callable. This removes redundant scans rather than deferring discovery to the first prompt.

@daviddanialy

Copy link
Copy Markdown
Contributor Author

@kit-code-agent review

1 similar comment
@danielkov

Copy link
Copy Markdown
Contributor

@kit-code-agent review

Comment thread scripts/benchmark-tui-launch.py Resolved

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compose formats the catalog enumerated by its builder while preserving live skill discovery for refresh, permission checks, and invocation. The Unix terminal probe reads queued bytes directly while retaining its deadline, byte limit, and stop at the terminal status reply. No active findings remain.

Took 2 min 3 sec

@daviddanialy
daviddanialy merged commit 0496254 into main Dec 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants