Skip to content

Improve Windows terminal performance: retain WebGL contexts, warm first ConPTY - #7085

Merged
Jinwoo-H merged 11 commits into
mainfrom
Jinwoo-H/windows-performance-improvement
Jul 2, 2026
Merged

Jinwoo-H merged 11 commits into
mainfrom
Jinwoo-H/windows-performance-improvement

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Windows terminal interactions (workspace switching, terminal creation, tab switching) are noticeably slower than macOS, and #6874-style hangs were reported around terminal activation. This PR benchmarks the gaps, fixes the highest-impact Windows-specific costs, and supersedes #7080 (its commits are merged in here).

No WebGL disabling anywhere — every fix keeps GPU rendering and addresses the actual waste.

What's included

From #7080 (merged in, unchanged): eager WebGL context release on pane disposal, pty:kill synthesizing pty:exit when provider shutdown is silent (stale-terminal recovery), and the Windows/WSL AppHang repro harness.

New in this branch:

  1. Retain terminal WebGL contexts across workspace hide/show (pane-webgl-context-retention.ts)
    Workspace switches disposed every hidden pane's WebGL context and recreated it on return — ~5ms on macOS but 100–500ms per pane on Windows (ANGLE → D3D11), paid synchronously on the switch path (the old code comment admitted this). The dispose-on-hide policy guarded Chromium's 16-context budget, which Raise WebGL terminal context budget and recover from context loss #7064 raised to 128, so the premise is stale. Suspended panes now keep live contexts in an LRU (cap 32, sized for ~10–16 worktrees × ~2 terminals hot sets; evictions disposed through the Fix terminal activation WebGL cleanup and stale PTY recovery #7080 release path); resume repaints instead of recreating. Atlas-recovery bursts now skip suspended panes, so recovery cost scales with visible panes instead of total panes across all workspaces. Retention is gated to Windows (runtime platform check): context creation is ~5ms on macOS/Linux GL, so those platforms keep the long-proven dispose-on-hide behavior and pay no retention GPU-memory cost. The atlas-recovery scoping applies on all platforms.

  2. Bundled ConPTY for LocalPtyProvider spawns (local-pty-utils.ts)
    The daemon spawn path passes useConptyDll: true; degraded-mode/fresh-local spawns silently ran on the legacy system ConPTY (which the daemon path's own comment blames for full-width TUI scrollback corruption). Now consistent.

  3. Warm the daemon's first ConPTY at boot (windows-conpty-warmup.ts)
    The first ConPTY spawn in the daemon pays one-time costs (conpty native module load, bundled conpty.dll + OpenConsole.exe first launch, Defender scans): measured 2.75s inside provider.spawn vs ~70ms warm — previously paid by the user's first terminal. A throwaway cmd.exe /c exit at daemon boot absorbs it.

  4. Measurement infrastructure

    • tools/benchmarks/terminal-perf-bench.mjs: CDP-driven benchmark of tab-create / tab-switch / workspace-switch with renderer-clock phase timings (store → PTY bind → first output → paint settle), longtask counts, WebGL context diagnostics.
    • ORCA_PTY_SPAWN_TIMING=1: one log line per pty:spawn attributing latency to barrier/auth/host-env/provider phases (pty-spawn-timing.ts).

Measurements (Windows 11, dev build, JSON reports in tools/benchmarks/results/)

metric baseline after
first-terminal provider_spawn (cold daemon) 2749ms 1255ms¹
workspace-switch activation (median) 202ms 159ms
hidden panes keeping WebGL contexts (3-pane fixture) 1/3 3/3
steady-state spawn, main-process handler total ~115ms (host_env≈50, provider_spawn≈68) unchanged

¹ The benchmark opens a terminal ~1s after app-ready, so the real spawn still queues behind the in-flight warm-up; with a realistic gap the cost is fully absorbed. Workspace-switch gains scale with panes-per-worktree and GPU slowness; the fixture is 1 pane/worktree on a fast GPU.

Spawn-phase attribution also shows steady-state tab-create (~500ms) is dominated by renderer-side work (xterm open + WebGL context creation for the new pane), not the PTY path — see follow-ups.

Follow-ups (documented in notes/windows-perf-progress.md)

  • Tab-switch paint settle (median ~80ms) is the light-tab-resume atlas recovery burst (3× shared-atlas clear + all-pane refresh per switch). Risky output already schedules parse-time recovery, so the reveal-time burst can likely become a scoped repaint — but Prevent stale terminal pixels on tab reveal #7058 touched this and was reverted (Revert "Prevent stale terminal pixels on tab reveal" #7073), so it needs that context first.
  • Renderer-side ~400ms of tab creation (possibly defer WebGL attach for brand-new panes).
  • Cold-restore respawn fan-out has no concurrency cap; node-pty ≥1.2.0-beta defers ConPTY connect (spawn returns fast), which would stop respawn storms serializing the daemon loop.

Verification

  • pnpm exec vitest run on pane-manager (317), terminal-pane (1421), providers + daemon suites, focused pty kill/exit tests — all pass.
  • pnpm run typecheck, oxlint on changed files — clean.
  • Benchmark before/after reports committed; retention verified via WebGL context diagnostics.
  • Pre-existing Windows-only failures (also on main; CI is ubuntu-only): 5 attribution-shim PATH assertions in src/main/ipc/pty.test.ts, 1 WSL env-import test in pty-subprocess.test.ts.

Supersedes #7080. Refs #6874.

@Jinwoo-H
Jinwoo-H marked this pull request as ready for review July 2, 2026 08:11
@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

This PR adds Windows-specific repro and benchmark tooling, plus main-process PTY and ConPTY updates and renderer WebGL retention changes. New scripts reproduce a terminal-activation hang across WSL and GPU modes and benchmark terminal interaction latency, with JSON outputs and recorded results. The main process now records PTY spawn timing, warms ConPTY on daemon startup, enables ConPTY DLL mode for Windows PTY spawns, and deduplicates PTY exit delivery. The renderer now retains suspended WebGL contexts on Windows, refreshes retained panes on resume, and releases WebGL resources through shared disposal logic.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is detailed, but it omits required Screenshots, AI Review Report, Security Audit, and Notes sections from the template. Add the missing template sections and include a short cross-platform AI review plus a basic security audit and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Concise title matches the main change: Windows terminal performance improvements via WebGL retention and ConPTY warmup.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 8

🧹 Nitpick comments (1)
src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts (1)

18-28: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Avoid relying on xterm-addon-webgl private renderer fields. releaseXtermWebglContext reaches into _renderer._gl / _renderer._canvas, so an addon shape change turns this into a silent no-op because the catch swallows the failure. Add a small runtime warning or fallback when those internals are absent so the context-release workaround doesn’t fail quietly.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 341919c1-6938-4120-bf64-6c9b623bc2e3

📥 Commits

Reviewing files that changed from the base of the PR and between 151c567 and 93b1f18.

📒 Files selected for processing (27)
  • config/scripts/repro-windows-apphang-terminal-activation.mjs
  • config/scripts/windows-apphang-repro/apphang-report-summary.mjs
  • config/scripts/windows-apphang-repro/electron-dev-session.mjs
  • config/scripts/windows-apphang-repro/repro-timing.mjs
  • config/scripts/windows-apphang-repro/terminal-activation-scenario.mjs
  • config/scripts/windows-apphang-repro/wsl-workspace-fixture.mjs
  • notes/windows-perf-progress.md
  • src/main/daemon/daemon-entry.ts
  • src/main/daemon/windows-conpty-warmup.test.ts
  • src/main/daemon/windows-conpty-warmup.ts
  • src/main/ipc/pty-spawn-timing.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-utils-windows-fallback.test.ts
  • src/main/providers/local-pty-utils.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/renderer/src/lib/pane-manager/pane-manager.ts
  • src/renderer/src/lib/pane-manager/pane-rendering-control.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts
  • tools/benchmarks/results/terminal-perf-baseline-2026-07-02T07-23-46-933Z.json
  • tools/benchmarks/results/terminal-perf-fix-a-b-2026-07-02T07-46-58-178Z.json
  • tools/benchmarks/results/terminal-perf-fix-abd-2026-07-02T07-51-00-936Z.json
  • tools/benchmarks/results/terminal-perf-fix-abdf-2026-07-02T07-59-11-820Z.json
  • tools/benchmarks/terminal-perf-bench.mjs

Comment on lines +16 to +19
export function createPtySpawnTiming(): PtySpawnTiming {
if (!process.env.ORCA_PTY_SPAWN_TIMING) {
return noopTiming
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Truthiness check accepts ORCA_PTY_SPAWN_TIMING=0 as enabled.

Any non-empty string enables timing, including "0"/"false", contradicting the documented =1 contract.

🔧 Proposed fix
 export function createPtySpawnTiming(): PtySpawnTiming {
-  if (!process.env.ORCA_PTY_SPAWN_TIMING) {
+  if (process.env.ORCA_PTY_SPAWN_TIMING !== '1') {
     return noopTiming
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function createPtySpawnTiming(): PtySpawnTiming {
if (!process.env.ORCA_PTY_SPAWN_TIMING) {
return noopTiming
}
export function createPtySpawnTiming(): PtySpawnTiming {
if (process.env.ORCA_PTY_SPAWN_TIMING !== '1') {
return noopTiming
}

Comment thread src/main/ipc/pty.ts Resolved
@Jinwoo-H
Jinwoo-H force-pushed the Jinwoo-H/windows-performance-improvement branch from e5abd97 to c6a77ab Compare July 2, 2026 18:45
@Jinwoo-H

Jinwoo-H commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all 8 review comments in c6a77aba6 (branch also rebased onto latest main):

  • kill/stopAndWait synthetic-exit guard: both runtime-controller paths now use shutdownProviderAndDetectExit with the same remember/consume dedup as the renderer pty:kill handler, including the provider-unregistered tombstone branches — plus renderer pty:exit synthesis when shutdown is silent. Two new tests assert single-delivery for controller kill and stopAndWait.
  • Renderer drift probe: reset per activation cycle.
  • Harness failures: now recorded as harnessError (inconclusive) instead of reproduced; the entry script exits 1 for both --expect=repro and --expect=pass when any run had a harness error.
  • Telemetry: disposable profile now opts out (existedBeforeTelemetryRelease: false keeps the consent surface from appearing).
  • ORCA_PTY_SPAWN_TIMING: 0/false now disable.
  • Benchmark stats: timed-out samples excluded from median/p95/max (kept in the timedOut count).
  • Benchmark teardown: report initialized before launch; stopDevApp failure no longer skips report write or temp-dir cleanup.
  • path.join for the dev-runner script path.

One transient-failure branch in controller kill intentionally keeps firing runtime.onPtyExit(-1) without marking a synthetic exit: no renderer exit is synthesized there and provider state is preserved for retry, so swallowing a later real exit would lose the renderer notification.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/main/ipc/pty.test.ts (1)

2389-2391: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Possible flakiness: double Promise.resolve() vs. setImmediate pattern used elsewhere.

The line-range summary explains that a sibling test (Line 2334-2336) needed to switch from a single microtask flush to setImmediate because kill's shutdown now runs through the exit-detection wrapper, which adds async hops; a single microtask flush is no longer enough. This new test relies on exactly two await Promise.resolve() calls, which is fragile if the number of async hops in the kill/shutdown/dedup chain changes again (e.g. shutdownProviderAndDetectExit's try/finally plus the .then() callback in kill()). Consider using await new Promise((resolve) => setImmediate(resolve)) here as well for consistency and robustness.

Suggested fix
         expect(controller.kill('local-pty')).toBe(true)
-        await Promise.resolve()
-        await Promise.resolve()
+        await new Promise((resolve) => setImmediate(resolve))

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d9cd742b-89fa-4504-b652-79099d4d4c32

📥 Commits

Reviewing files that changed from the base of the PR and between e5abd97 and c6a77aba61703e09836b08c4e6330278aa0c104e.

📒 Files selected for processing (27)
  • config/scripts/repro-windows-apphang-terminal-activation.mjs
  • config/scripts/windows-apphang-repro/apphang-report-summary.mjs
  • config/scripts/windows-apphang-repro/electron-dev-session.mjs
  • config/scripts/windows-apphang-repro/repro-timing.mjs
  • config/scripts/windows-apphang-repro/terminal-activation-scenario.mjs
  • config/scripts/windows-apphang-repro/wsl-workspace-fixture.mjs
  • notes/windows-perf-progress.md
  • src/main/daemon/daemon-entry.ts
  • src/main/daemon/windows-conpty-warmup.test.ts
  • src/main/daemon/windows-conpty-warmup.ts
  • src/main/ipc/pty-spawn-timing.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-utils-windows-fallback.test.ts
  • src/main/providers/local-pty-utils.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/renderer/src/lib/pane-manager/pane-manager.ts
  • src/renderer/src/lib/pane-manager/pane-rendering-control.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts
  • tools/benchmarks/results/terminal-perf-baseline-2026-07-02T07-23-46-933Z.json
  • tools/benchmarks/results/terminal-perf-fix-a-b-2026-07-02T07-46-58-178Z.json
  • tools/benchmarks/results/terminal-perf-fix-abd-2026-07-02T07-51-00-936Z.json
  • tools/benchmarks/results/terminal-perf-fix-abdf-2026-07-02T07-59-11-820Z.json
  • tools/benchmarks/terminal-perf-bench.mjs
✅ Files skipped from review due to trivial changes (2)
  • src/main/providers/local-pty-utils-windows-fallback.test.ts
  • tools/benchmarks/results/terminal-perf-baseline-2026-07-02T07-23-46-933Z.json
🚧 Files skipped from review as they are similar to previous changes (18)
  • src/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/main/providers/local-pty-utils.ts
  • src/main/ipc/pty-spawn-timing.ts
  • src/renderer/src/lib/pane-manager/pane-manager.ts
  • src/main/daemon/windows-conpty-warmup.test.ts
  • src/main/daemon/windows-conpty-warmup.ts
  • config/scripts/windows-apphang-repro/apphang-report-summary.mjs
  • src/renderer/src/lib/pane-manager/pane-rendering-control.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.ts
  • src/main/daemon/daemon-entry.ts
  • tools/benchmarks/terminal-perf-bench.mjs
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts
  • config/scripts/windows-apphang-repro/electron-dev-session.mjs
  • config/scripts/windows-apphang-repro/terminal-activation-scenario.mjs
  • config/scripts/windows-apphang-repro/wsl-workspace-fixture.mjs
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.test.ts
  • src/main/ipc/pty.ts

args.deadPtyReactivate = false
continue
}
const [name, value] = arg.split('=', 2)

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the target file and inspect the relevant section.
git ls-files 'config/scripts/repro-windows-apphang-terminal-activation.mjs'
wc -l config/scripts/repro-windows-apphang-terminal-activation.mjs
cat -n config/scripts/repro-windows-apphang-terminal-activation.mjs | sed -n '1,130p'

# Probe the actual split semantics on representative inputs.
node - <<'JS'
const samples = [
  '--report=C:\\path\\run=1.json',
  '--distro=foo=bar',
  '--name=value',
  '--flag'
];

for (const arg of samples) {
  const [name, value] = arg.split('=', 2);
  const eqIndex = arg.indexOf('=');
  const value2 = eqIndex === -1 ? undefined : arg.slice(eqIndex + 1);
  console.log({ arg, splitName: name, splitValue: value, firstEqValue: value2 });
}
JS

Repository: stablyai/orca

Length of output: 5940


arg.split('=', 2) truncates values containing =.

String.prototype.split(separator, limit) drops the remainder once the limit is reached, so --report=C:\path\run=1.json or --distro=foo=bar loses everything after the first = in the value. Split on the first = instead.

Comment on lines +285 to +302
"worktreeId": "62e7f2fd-6fb6-446e-bded-2866c26a968e::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-rrZN7p/repo",
"ptyId": "62e7f2fd-6fb6-446e-bded-2866c26a968e::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-rrZN7p/repo@@588e69ce",
"activationMs": 240,
"ptyBindMs": 247,
"paintSettleMs": 254
},
{
"index": 1,
"worktreeId": "62e7f2fd-6fb6-446e-bded-2866c26a968e::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-rrZN7p/wt-one",
"ptyId": "62e7f2fd-6fb6-446e-bded-2866c26a968e::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-rrZN7p/wt-one@@407494c8",
"activationMs": 423,
"ptyBindMs": 573,
"paintSettleMs": 584
},
{
"index": 2,
"worktreeId": "62e7f2fd-6fb6-446e-bded-2866c26a968e::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-rrZN7p/wt-two",
"ptyId": "62e7f2fd-6fb6-446e-bded-2866c26a968e::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-rrZN7p/wt-two@@5d681b07",

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact machine-specific paths before committing benchmark artifacts.

This file embeds C:/Users/jinwo/... in sample data and logs, which leaks a local username/temp workspace layout and makes the artifact non-portable. Please normalize or redact these values across the whole file.

Comment on lines +288 to +305
"worktreeId": "f5b2567a-69b4-41a3-ba29-8c4bd357042d::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-J3tKUm/repo",
"ptyId": "f5b2567a-69b4-41a3-ba29-8c4bd357042d::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-J3tKUm/repo@@14096c3d",
"activationMs": 281,
"ptyBindMs": 283,
"paintSettleMs": 293
},
{
"index": 1,
"worktreeId": "f5b2567a-69b4-41a3-ba29-8c4bd357042d::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-J3tKUm/wt-one",
"ptyId": "f5b2567a-69b4-41a3-ba29-8c4bd357042d::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-J3tKUm/wt-one@@0b21e66f",
"activationMs": 344,
"ptyBindMs": 524,
"paintSettleMs": 538
},
{
"index": 2,
"worktreeId": "f5b2567a-69b4-41a3-ba29-8c4bd357042d::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-J3tKUm/wt-two",
"ptyId": "f5b2567a-69b4-41a3-ba29-8c4bd357042d::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-J3tKUm/wt-two@@e63f448f",

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact machine-specific paths before committing benchmark artifacts.

This file embeds C:/Users/jinwo/... in sample data and logs, which leaks a local username/temp workspace layout and makes the artifact non-portable. Please normalize or redact these values across the whole file.

Comment on lines +285 to +302
"worktreeId": "cd78ddb3-9689-4d21-b87b-8e38f92d2e7b::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-IyoYoT/repo",
"ptyId": "cd78ddb3-9689-4d21-b87b-8e38f92d2e7b::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-IyoYoT/repo@@5810ae88",
"activationMs": 217,
"ptyBindMs": 219,
"paintSettleMs": 233
},
{
"index": 1,
"worktreeId": "cd78ddb3-9689-4d21-b87b-8e38f92d2e7b::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-IyoYoT/wt-one",
"ptyId": "cd78ddb3-9689-4d21-b87b-8e38f92d2e7b::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-IyoYoT/wt-one@@c450cf26",
"activationMs": 480,
"ptyBindMs": 575,
"paintSettleMs": 601
},
{
"index": 2,
"worktreeId": "cd78ddb3-9689-4d21-b87b-8e38f92d2e7b::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-IyoYoT/wt-two",
"ptyId": "cd78ddb3-9689-4d21-b87b-8e38f92d2e7b::C:/Users/jinwo/AppData/Local/Temp/orca-termperf-IyoYoT/wt-two@@ae6fdb06",

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact machine-specific paths before committing benchmark artifacts.

This file embeds C:/Users/jinwo/... in sample data and logs, which leaks a local username/temp workspace layout and makes the artifact non-portable. Please normalize or redact these values across the whole file.

Jinwoo-H added 11 commits July 2, 2026 15:27
Workspace switches disposed every hidden pane's WebGL context and recreated
it on return - ~5ms on macOS but 100-500ms per pane on Windows (ANGLE ->
D3D11), paid synchronously on the switch path. The dispose-on-hide policy
guarded Chromium's old 16-context budget, which #7064 raised to 128.

Suspended panes now keep their live contexts in an LRU (cap 16, evicted
panes disposed); resume repaints retained panes instead of recreating
contexts. Atlas recovery bursts skip suspended panes so recovery cost
scales with visible panes, not total pane count across workspaces.
The daemon spawn path already passes useConptyDll: true (bundled modern
ConPTY); LocalPtyProvider spawns - degraded mode and fresh-local routing -
silently ran on the legacy system ConPTY, which the daemon path's own
comment blames for full-width TUI scrollback corruption.
The first ConPTY spawn in the daemon process pays one-time costs (conpty
native module load, bundled conpty.dll + OpenConsole.exe first launch,
Defender scans) measured at ~2.7s inside provider.spawn on a dev profile
vs ~70ms warm - previously paid by the user's first terminal. A throwaway
cmd.exe /c exit spawn at daemon boot absorbs it off the interaction path.
ORCA_PTY_SPAWN_TIMING=1 logs one line per spawn attributing latency to
startup barrier, Claude auth prep, buildPtyHostEnv, options assembly, and
provider spawn - the split that separated renderer-side cost from daemon
cost in the terminal perf investigation.
CDP-driven harness measuring tab creation, tab switching, and workspace
switching against the real dev app with renderer-clock phase timings
(store -> PTY bind -> first output -> paint settle), longtask counts, and
WebGL context diagnostics. Reuses the windows-apphang-repro session
helpers; records ORCA_PTY_SPAWN_TIMING attribution when enabled.
Documents the cold-restore spawn fan-out point (renderer connect layer),
the daemon-init barrier's effect on an immediate first terminal, the
uncached in-daemon Windows shell resolution, and residual tab-switch
costs, so the follow-up work starts from measured locations.
Context re-creation is ~5ms on macOS/Linux GL, so retention buys no
perceptible switch latency there while still costing hidden-pane GPU
memory and a new lifecycle to reason about. Only Windows (ANGLE ->
D3D11, 100-500ms per pane) retains; other platforms keep the
long-proven dispose-on-hide behavior.
- Runtime controller kill/stopAndWait now use the same synthetic-exit
  detection as the renderer pty:kill handler, so providers that emit
  their own exit during shutdown no longer double-fire runtime.onPtyExit,
  and silent shutdowns now notify the renderer on these paths too.
- Repro harness: reset the renderer drift probe per activation cycle
  (cumulative drift misattributed startup stalls to later cycles),
  classify harness failures as inconclusive harnessError instead of
  reproduced, opt the disposable profile out of telemetry, and build the
  dev-runner path with path.join.
- Benchmark: exclude timed-out samples from percentile stats, initialize
  the report before launch, and keep a stopDevApp failure from skipping
  report write and temp-dir cleanup.
- ORCA_PTY_SPAWN_TIMING now treats 0/false as disabled.
Reported real-world usage runs 10+ worktrees with ~2 terminals each,
so a cap of 16 evicts inside the active switching set and returns to
those worktrees pay the context rebuild the retention exists to avoid.
32 covers ~10-16 worktrees x 2 panes (~100-250MB worst-case hidden
framebuffers) while staying far under the 128 context budget.
@Jinwoo-H
Jinwoo-H force-pushed the Jinwoo-H/windows-performance-improvement branch from 08614c0 to 37f7051 Compare July 2, 2026 19:29

@coderabbitai coderabbitai 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.

♻️ Duplicate comments (3)
tools/benchmarks/results/terminal-perf-fix-a-b-2026-07-02T07-46-58-178Z.json (1)

285-377: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact machine-specific paths before committing benchmark artifacts.

This artifact still embeds C:/Users/jinwo/... in IDs and logs, which leaks a local username/temp layout and makes the report non-portable. Please normalize or redact these values throughout the file.

tools/benchmarks/results/terminal-perf-fix-abd-2026-07-02T07-51-00-936Z.json (1)

285-377: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact machine-specific paths before committing benchmark artifacts.

This artifact still embeds C:/Users/jinwo/... in IDs and logs, which leaks a local username/temp layout and makes the report non-portable. Please normalize or redact these values throughout the file.

tools/benchmarks/results/terminal-perf-fix-abdf-2026-07-02T07-59-11-820Z.json (1)

285-377: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact machine-specific paths before committing benchmark artifacts.

This artifact still embeds C:/Users/jinwo/... in IDs and logs, which leaks a local username/temp layout and makes the report non-portable. Please normalize or redact these values throughout the file.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 86a1be97-8329-498e-9aa7-d29e503e5cf8

📥 Commits

Reviewing files that changed from the base of the PR and between 08614c018b05615367df6f84154de639e04b8ea4 and 37f7051.

📒 Files selected for processing (27)
  • config/scripts/repro-windows-apphang-terminal-activation.mjs
  • config/scripts/windows-apphang-repro/apphang-report-summary.mjs
  • config/scripts/windows-apphang-repro/electron-dev-session.mjs
  • config/scripts/windows-apphang-repro/repro-timing.mjs
  • config/scripts/windows-apphang-repro/terminal-activation-scenario.mjs
  • config/scripts/windows-apphang-repro/wsl-workspace-fixture.mjs
  • notes/windows-perf-progress.md
  • src/main/daemon/daemon-entry.ts
  • src/main/daemon/windows-conpty-warmup.test.ts
  • src/main/daemon/windows-conpty-warmup.ts
  • src/main/ipc/pty-spawn-timing.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts
  • src/main/providers/local-pty-utils-windows-fallback.test.ts
  • src/main/providers/local-pty-utils.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/renderer/src/lib/pane-manager/pane-manager.ts
  • src/renderer/src/lib/pane-manager/pane-rendering-control.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts
  • tools/benchmarks/results/terminal-perf-baseline-2026-07-02T07-23-46-933Z.json
  • tools/benchmarks/results/terminal-perf-fix-a-b-2026-07-02T07-46-58-178Z.json
  • tools/benchmarks/results/terminal-perf-fix-abd-2026-07-02T07-51-00-936Z.json
  • tools/benchmarks/results/terminal-perf-fix-abdf-2026-07-02T07-59-11-820Z.json
  • tools/benchmarks/terminal-perf-bench.mjs
✅ Files skipped from review due to trivial changes (1)
  • tools/benchmarks/results/terminal-perf-baseline-2026-07-02T07-23-46-933Z.json
🚧 Files skipped from review as they are similar to previous changes (21)
  • src/renderer/src/lib/pane-manager/pane-manager.ts
  • src/main/daemon/daemon-entry.ts
  • src/main/ipc/pty-spawn-timing.ts
  • src/main/daemon/windows-conpty-warmup.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.ts
  • src/main/providers/local-pty-utils.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/main/daemon/windows-conpty-warmup.test.ts
  • src/main/providers/local-pty-utils-windows-fallback.test.ts
  • tools/benchmarks/terminal-perf-bench.mjs
  • src/renderer/src/lib/pane-manager/pane-webgl-renderer.ts
  • src/renderer/src/lib/pane-manager/pane-webgl-refresh-lifecycle.test.ts
  • config/scripts/windows-apphang-repro/repro-timing.mjs
  • config/scripts/repro-windows-apphang-terminal-activation.mjs
  • src/renderer/src/lib/pane-manager/pane-rendering-control.ts
  • config/scripts/windows-apphang-repro/electron-dev-session.mjs
  • config/scripts/windows-apphang-repro/wsl-workspace-fixture.mjs
  • config/scripts/windows-apphang-repro/terminal-activation-scenario.mjs
  • src/renderer/src/lib/pane-manager/pane-webgl-context-retention.test.ts
  • src/main/ipc/pty.test.ts
  • src/main/ipc/pty.ts

@Jinwoo-H
Jinwoo-H merged commit 2ce9314 into main Jul 2, 2026
3 checks passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/windows-performance-improvement branch July 2, 2026 22:41
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

1 participant