mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
Third profiling round (after #66033 / #66347), targeting the composer model picker and dialog opens (worktree dialog etc.), measured over CDP on real 1000+-message sessions. Backend — model.options took 4.8s cold / 1.8s warm per call, and the desktop model pill/picker blocks on it every open: - agent/credential_pool: _load_config_safe uses load_config_readonly(). Every consumer only reads, and the per-call deepcopy was the dominant cost — list_authenticated_providers calls load_pool() per provider row, and each load_pool loaded (and deep-copied) the full config again via get_pool_strategy. - hermes_cli/config: memoize ensure_hermes_home() per home path. It runs inside the config lock on EVERY load_config(), paying ~14 mkdir/chmod syscalls per call. The fast path still re-checks that the home dir exists, so a deleted home is recreated as before; profile switches hit the new path and re-run. Tests cover both. - tui_gateway/server: add model.options to _LONG_HANDLERS. It measured seconds inline on the WS reader thread — while it ran, prompt.submit and session.interrupt sat unread (same class as #21123). Together: model.options RPC 4825/1842ms → 426/230ms (measured on the live desktop backend); build_models_payload in isolation 6.2s → 0.97s cold, 0.27s warm. Desktop — every Radix dialog/popover open forced a whole-document style recalc (Presence reads getComputedStyle on mount), which on a 1300-message transcript cost ~650-730ms per open (CPU profile: getAnimationName 483ms self). The worktree dialog (⌘⇧B) paid it on every single open: - thread/list: content-visibility:auto + contain-intrinsic-size on the per-turn group wrappers. Off-screen turns now skip style recalc, layout, and paint entirely; never-rendered turns hold a placeholder height (auto: remembered real size once rendered) so scrollbar and anchoring stay stable. Verified over CDP: worktree dialog open 656- 730ms → ~200ms on the same session; stick-to-bottom pin, scroll-to- top rendering, and sticky human bubbles all intact. Also: profile-session-switch harness accepts CDP_HTTP (Chrome tends to squat on 9222). Verification: - scripts/run_tests.sh: config, credential-pool, inventory, model-switch routing, tui_gateway protocol, profiles suites green (test_profiles has one pre-existing failure on main, unrelated); new tests for the ensure_hermes_home memo. - apps/desktop: tsc clean, eslint/prettier clean, thread + session suites green (326 tests). - E2E over CDP on the live app: numbers above, plus scroll/pin sanity. |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| after-pack.mjs | ||
| assert-dist-built.mjs | ||
| assert-dist-built.test.mjs | ||
| assert-root-install.mjs | ||
| before-build.mjs | ||
| before-pack.mjs | ||
| before-pack.test.mjs | ||
| bundle-electron-main.mjs | ||
| click-session.mjs | ||
| dev-no-hmr.mjs | ||
| diag-jump.mjs | ||
| diag-scroll-reset.mjs | ||
| eval.mjs | ||
| gen-share-codes.ts | ||
| leak-typing.mjs | ||
| measure-jump.mjs | ||
| measure-latency.mjs | ||
| measure-profile-switch.mjs | ||
| measure-real-stream.mjs | ||
| measure-submit.mjs | ||
| measure-synthetic-stream.mjs | ||
| notarize-artifact.mjs | ||
| notarize.mjs | ||
| patch-electron-builder-mac-binary.mjs | ||
| probe-renderer.mjs | ||
| probe-thread.mjs | ||
| profile-long-stream.mjs | ||
| profile-real-stream.mjs | ||
| profile-session-switch.mjs | ||
| profile-synth-stream.mjs | ||
| profile-typing-lag.md | ||
| profile-typing.mjs | ||
| rebuild-native.mjs | ||
| reload-renderer.mjs | ||
| reload.mjs | ||
| run-electron-builder.mjs | ||
| set-exe-identity.mjs | ||
| stage-native-deps.mjs | ||
| stage-native-deps.test.mjs | ||
| test-desktop.mjs | ||
| utils.mjs | ||
| write-build-stamp.mjs | ||