perf: reduce startup time by 30-50% via faster CDP polling and model list shortcut#620
Open
congxb wants to merge 3 commits into
Open
perf: reduce startup time by 30-50% via faster CDP polling and model list shortcut#620congxb wants to merge 3 commits into
congxb wants to merge 3 commits into
Conversation
…list shortcut - Reduce CDP injection polling granularity: 1s→200ms (ensure_injection), 500ms→200ms (retry_injection, inject_with_context), with increased max attempts to maintain total wait capacity - Short-circuit app-server list-models-for-host RPC: return model list from Codex++ bridge (relay profile config, <1ms) instead of waiting for Codex's own app-server process to start (~34s) - Add diagnostic timing logs to measure injection phase durations
Owner
|
试了吗 |
Author
|
windows 11 试过,可以,主要是跳过 gpt 请求自己的模型,34秒,适配第三方模型用的,你可以试试,可能有其他问题,但是自己用够了,已经实际部署使用了 |
Align ensure_injection signature with main (added app_dir param). This is the base before re-applying perf changes. @
Rebase onto main to fix ensure_injection signature (app_dir param). Re-apply all perf optimizations: 1. Faster CDP polling (200ms intervals, 300 attempts) 2. Model list short-circuit (already merged in main) 3. Diagnostic timing logs (injection_succeeded, codex_launched, etc.) @
Owner
|
清解决冲突 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces CodexPlusPlus startup time by 30-50% through two independent optimizations: faster CDP injection polling and short-circuiting the model list request to avoid waiting for Codex's internal app-server.
Changes
1. Faster CDP injection polling (3 files)
The nested retry loops in ensure_injection used coarse sleep intervals (1s/500ms). When running with Windows Store Codex (which takes longer to start), these accumulate significant delay. The granularity alone accounted for ~15s of startup time.
Max wait capacity remains ~60s (vs original ~120s), but with 5x finer granularity.
2. Short-circuit app-server model list RPC (1 file)
When the Codex renderer calls list-models-for-host via the app-server RPC, the inject script previously waited for the app-server response (~34s on first startup). Since Codex++ already has the model list from the relay profile configuration via /codex-model-catalog bridge endpoint (<1ms), we can return it immediately.
assets/inject/renderer-inject.js: In patchAppServerModelRequestClient, check if model names are available from the bridge before waiting for the app-server. If available, return them directly (as an empty data array that patchModelArray populates with full model descriptors via codexPlusModelDescriptor).
3. Diagnostic timing logs
Added elapsed-time logging to ensure_injection retries and launch_and_inject_with_hooks to help future debugging of startup bottlenecks. Events: launcher.codex_launched, launcher.injection_succeeded, launcher.ready.
Measured improvement
Before (on Windows Store Codex with agnes-ai provider):
After:
The remaining ~33s is Codex's own React/V8 initialization time (parsing the large JS bundle), which is outside Codex++'s control.
Files Changed
Test Plan