[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BTEVQG0G7NACTS84ZCNRSR":3,"skill-same:01M7BTEVQG0G7NACTS84ZCNRSR":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7BTEVQG0G7NACTS84ZCNRSR","chat-perf",null,"Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.","YYC-Cube\u002FYYC3-Knowledge-Base","YYC-Cube","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235006543?v=4","01M79J2PH4SWD2X0825X6PN748","yyc3","01M79J2PHVK3F6ZBYT8K2SCZCW",1,"MIT","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-IDE-编辑器内核\u002FYYC3-IDE-编辑器内核-vscode\u002F.github\u002Fskills\u002Fchat-perf\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: chat-perf\ndescription: Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.\n---\n\n# Chat Performance Testing\n\n## When to use\n\n- Before\u002Fafter modifying chat rendering code (`chatListRenderer.ts`, `chatInputPart.ts`, markdown rendering)\n- When changing the streaming response pipeline or SSE processing\n- When modifying disposable\u002Flifecycle patterns in chat components\n- To compare performance between two VS Code releases\n- In CI to gate PRs that touch chat UI code\n\n## Quick start\n\n```bash\n# Run perf regression test (compares local dev build vs VS Code 1.115.0):\nnpm run perf:chat -- --scenario text-only --runs 3\n\n# Run all scenarios with no baseline (just measure):\nnpm run perf:chat -- --no-baseline --runs 3\n\n# Compare two local builds (apples-to-apples):\nnpm run perf:chat -- --build \u002Fpath\u002Fto\u002Fbuild-A --baseline-build \u002Fpath\u002Fto\u002Fbuild-B --runs 5\n\n# Build a local production package and compare against a release:\nnpm run perf:chat -- --production-build --baseline-build 1.115.0 --runs 5\n\n# Run memory leak check (10 messages in one session):\nnpm run perf:chat-leak\n\n# Run leak check with more messages for accuracy:\nnpm run perf:chat-leak -- --messages 20 --verbose\n```\n\n## Perf regression test\n\n**Script:** `scripts\u002Fchat-simulation\u002Ftest-chat-perf-regression.js`\n**npm:** `npm run perf:chat`\n\nLaunches VS Code via Playwright Electron, opens the chat panel, sends a message with a mock LLM response, and measures timing, layout, and rendering metrics. By default, downloads VS Code 1.115.0 as a baseline, benchmarks it, then benchmarks the local dev build and compares.\n\n### Key flags\n\n| Flag | Default | Description |\n|---|---|---|\n| `--runs \u003Cn>` | `5` | Runs per scenario. More = more stable. Use 5+ for CI. |\n| `--scenario \u003Cid>` \u002F `-s` | all | Scenario to test (repeatable). See `common\u002Fperf-scenarios.js`. |\n| `--build \u003Cpath\\|ver>` \u002F `-b` | local dev | Build to test. Accepts path or version (`1.110.0`, `insiders`, commit hash). |\n| `--baseline \u003Cpath>` | — | Compare against a previously saved baseline JSON file. |\n| `--baseline-build \u003Cpath\\|ver>` | `1.115.0` | Version or local path to benchmark as baseline. |\n| `--no-baseline` | — | Skip baseline comparison entirely. |\n| `--save-baseline` | — | Save results as the new baseline (requires `--baseline \u003Cpath>`). |\n| `--resume \u003Cpath>` | — | Resume a previous run, adding more iterations to increase confidence. |\n| `--threshold \u003Cfrac>` | `0.2` | Regression threshold (0.2 = flag if 20% slower). |\n| `--production-build` | — | Build a local bundled package via `gulp vscode` for comparison against a release baseline. |\n| `--no-cache` | — | Ignore cached baseline data, always run fresh. |\n| `--force` | — | Skip build mode mismatch confirmation prompt. |\n| `--ci` | — | CI mode: write Markdown summary to `ci-summary.md` (implies `--no-cache`, `--heap-snapshots`, `--cleanup-diagnostics`). |\n| `--heap-snapshots` | — | Take heap snapshots after each run (slow; auto-enabled in `--ci` mode). |\n| `--cleanup-diagnostics` | — | Delete heap snapshots, CPU profiles, and traces to save disk. During runs, only the latest run's files are kept; after comparison, files for non-regressed scenarios are deleted. Auto-enabled in `--ci` mode. |\n| `--setting \u003Ck=v>` | — | Set a VS Code setting override for all builds (repeatable). |\n| `--test-setting \u003Ck=v>` | — | Set a VS Code setting override for the test build only. |\n| `--baseline-setting \u003Ck=v>` | — | Set a VS Code setting override for the baseline build only. |\n| `--verbose` | — | Print per-run details including response content. |\n\n### Comparing two remote builds\n\n```bash\n# Compare 1.110.0 against 1.115.0 (no local build needed):\nnpm run perf:chat -- --build 1.110.0 --baseline-build 1.115.0 --runs 5\n```\n\n### Comparing two local builds\n\nBoth `--build` and `--baseline-build` accept local paths to VS Code executables. This enables apples-to-apples comparisons between any two builds:\n\n```bash\n# Compare two dev builds (e.g. feature branch vs main):\nnpm run perf:chat -- \\\n  --build .build\u002Felectron\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --baseline-build \u002Fpath\u002Fto\u002Fother\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --runs 5\n\n# Compare two production builds:\nnpm run perf:chat -- \\\n  --build ..\u002FVSCode-darwin-arm64-feature\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --baseline-build ..\u002FVSCode-darwin-arm64-main\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --runs 5\n```\n\nLocal path baselines are never cached (the build may change between runs). Version string baselines are cached for reuse.\n\n### Build modes and mismatch detection\n\nThe tool classifies builds into three modes based on the executable path:\n\n| Mode | Source | Characteristics |\n|---|---|---|\n| `dev` | `.build\u002Felectron\u002F` (local dev) | Unbundled sources, `VSCODE_DEV=1`, `NODE_ENV=development`. Higher memory and startup overhead. |\n| `production` | `..\u002FVSCode-\u003Cplatform>-\u003Carch>\u002F` (from `gulp vscode`) | Bundled JS, no dev flags. Matches release characteristics but uses local source. |\n| `release` | `.vscode-test\u002F` (downloaded via `@vscode\u002Ftest-electron`) | Official published build. |\n\nWhen test and baseline builds have different modes (e.g. dev vs release), the tool shows a warning and prompts for confirmation. Use `--force` or `--ci` to skip the prompt.\n\nUsing `--production-build` builds a local bundled package via `gulp vscode` for fair comparison against a release baseline. This eliminates dev-mode overhead while still testing your local changes.\n\n```bash\n# Production build vs release baseline (fair comparison):\nnpm run perf:chat -- --production-build --baseline-build 1.115.0 --runs 5\n```\n\n### Settings overrides\n\nUse `--setting`, `--test-setting`, and `--baseline-setting` to inject VS Code settings into the launched instance. This is useful for A\u002FB testing experimental features:\n\n```bash\n# Enable a feature for the test build only:\nnpm run perf:chat -- --test-setting chat.experimental.incrementalRendering.enabled=true --runs 3\n\n# Compare two builds with different settings:\nnpm run perf:chat -- \\\n  --baseline-build \"..\u002Fvscode2\u002F.build\u002Felectron\u002FCode - OSS.app\u002FContents\u002FMacOS\u002FCode - OSS\" \\\n  --baseline-setting chat.experimental.incrementalRendering.enabled=true \\\n  --test-setting chat.experimental.incrementalRendering.enabled=false \\\n  --runs 3\n\n# Set a value for both builds:\nnpm run perf:chat -- --setting chat.mcp.enabled=false --runs 3\n```\n\nPrecedence: `--test-setting` \u002F `--baseline-setting` override `--setting` for the same key. Values are auto-parsed: `true`\u002F`false` become booleans, numbers become numbers, everything else stays a string.\n\n### Resuming a run for more confidence\n\nWhen results exceed the threshold but aren't statistically significant, the tool prints a `--resume` hint. Use it to add more iterations to an existing run:\n\n```bash\n# Initial run with 3 iterations — may be inconclusive:\nnpm run perf:chat -- --scenario text-only --runs 3\n\n# Add 3 more runs to the same results file (both test + baseline):\nnpm run perf:chat -- --resume .chat-simulation-data\u002F2026-04-14T02-15-14\u002Fresults.json --runs 3\n\n# Keep adding until confidence is reached:\nnpm run perf:chat -- --resume .chat-simulation-data\u002F2026-04-14T02-15-14\u002Fresults.json --runs 5\n```\n\n`--resume` loads the previous `results.json` and its associated `baseline-*.json`, runs N more iterations for both builds, merges rawRuns, recomputes stats, and re-runs the comparison. The updated files are written back in-place. You can resume multiple times — samples accumulate.\n\n### Statistical significance\n\nRegression detection uses **Welch's t-test** to avoid false positives from noisy measurements. A metric is only flagged as `REGRESSION` when it both exceeds the threshold AND is statistically significant (p \u003C 0.05). Otherwise it's reported as `(likely noise — p=X, not significant)`.\n\nWith typical variance (cv ≈ 20%), you need:\n- **n ≥ 5** per build to detect a 35% regression at 95% confidence\n- **n ≥ 10** per build to detect a 20% regression reliably\n\nConfidence levels reported: `high` (p \u003C 0.01), `medium` (p \u003C 0.05), `low` (p \u003C 0.1), `none`.\n\n### Exit codes\n\n- `0` — all metrics within threshold, or exceeding threshold but not statistically significant\n- `1` — statistically significant regression detected, or all runs failed\n\n### Scenarios\n\nScenarios are defined in `scripts\u002Fchat-simulation\u002Fcommon\u002Fperf-scenarios.js` and registered via `registerPerfScenarios()`. There are three categories:\n\n- **Content-only** — plain streaming responses (e.g. `text-only`, `large-codeblock`, `rapid-stream`)\n- **Tool-call** — multi-turn scenarios with tool invocations (e.g. `tool-read-file`, `tool-edit-file`)\n- **Multi-turn user** — multi-turn conversations with user follow-ups, thinking blocks (e.g. `thinking-response`, `multi-turn-user`, `long-conversation`)\n\nRun `npm run perf:chat -- --help` to see the full list of registered scenario IDs.\n\n### Metrics collected\n\n- **Timing:** time to first token, time to complete, time to render complete (includes typewriter animation)\n- **Rendering:** layout count, layout duration (ms), style recalculation count, forced reflows, long tasks (>50ms), long animation frame count and duration\n- **Memory:** heap before\u002Fafter, heap delta post-GC (informational, noisy for single requests)\n- **Extension host:** heap before\u002Fafter\u002Fdelta via CDP inspector\n\n### Regression triggers vs informational metrics\n\nOnly these metrics trigger a regression failure (when they exceed the threshold with statistical significance):\n- `timeToFirstToken`, `timeToComplete` — user-perceived latency\n- `forcedReflowCount` — forced synchronous layouts are always bad\n- `longTaskCount`, `longAnimationFrameCount` — main thread jank\n\nThese are reported but **informational only** (won't fail CI):\n- `layoutCount` — inflated by CSS animations; use `layoutDurationMs` instead\n- `layoutDurationMs` — total layout time from trace (more meaningful than count)\n- `recalcStyleCount` — inflated by CSS animations (compositor-driven, cheap)\n- `timeToRenderComplete` — includes typewriter animation tail\n- Memory\u002Fheap metrics — too noisy for single-request benchmarks\n\n### Statistics\n\nResults use **IQR-based outlier removal** and **median** (not mean) to handle startup jitter. The **coefficient of variation (cv)** is reported — under 15% is stable, over 15% gets a ⚠ warning. Baseline comparison uses **Welch's t-test** on raw run values to determine statistical significance before flagging regressions. Use 5+ runs to get stable results.\n\n## Memory leak check\n\n**Script:** `scripts\u002Fchat-simulation\u002Ftest-chat-mem-leaks.js`\n**npm:** `npm run perf:chat-leak`\n\nLaunches one VS Code session, sends N messages sequentially, forces GC between each, and measures renderer heap and DOM node count. Uses **linear regression** on the samples to compute per-message growth rate, which is compared against a threshold.\n\n### Key flags\n\n| Flag | Default | Description |\n|---|---|---|\n| `--messages \u003Cn>` \u002F `-n` | `10` | Number of messages to send. More = more accurate slope. |\n| `--build \u003Cpath\\|ver>` \u002F `-b` | local dev | Build to test. |\n| `--threshold \u003CMB>` | `2` | Max per-message heap growth in MB. |\n| `--setting \u003Ck=v>` | — | Set a VS Code setting override (repeatable). |\n| `--verbose` | — | Print per-message heap\u002FDOM counts. |\n\n### What it measures\n\n- **Heap growth slope** (MB\u002Fmessage) — linear regression over forced-GC heap samples. A leak shows as sustained positive slope.\n- **DOM node growth** (nodes\u002Fmessage) — catches rendering leaks where elements aren't cleaned up. Healthy chat virtualizes old messages so node count plateaus.\n\n### Interpreting results\n\n- `0.3–1.0 MB\u002Fmsg` — normal (V8 internal overhead, string interning)\n- `>2.0 MB\u002Fmsg` — likely leak, investigate retained objects\n- DOM nodes stable after first message — normal (chat list virtualization working)\n- DOM nodes growing linearly — rendering leak, check disposable cleanup\n\n## Architecture\n\n```\nscripts\u002Fchat-simulation\u002F\n├── common\u002F\n│   ├── mock-llm-server.js    # Mock CAPI server matching @vscode\u002Fcopilot-api URL structure\n│   ├── perf-scenarios.js     # Built-in scenario definitions (content, tool-call, multi-turn)\n│   └── utils.js              # Shared: paths, env setup, stats, launch helpers\n├── config.jsonc              # Default config (baseline version, runs, thresholds)\n├── fixtures\u002F                 # TypeScript fixture files used by tool-call scenarios\n├── test-chat-perf-regression.js\n└── test-chat-mem-leaks.js\n```\n\n### Mock server\n\nThe mock LLM server (`common\u002Fmock-llm-server.js`) implements the full CAPI URL structure from `@vscode\u002Fcopilot-api`'s `DomainService`:\n\n- `GET \u002Fmodels` — returns model metadata\n- `POST \u002Fmodels\u002Fsession` — returns `AutoModeAPIResponse` with `available_models` and `session_token`\n- `POST \u002Fmodels\u002Fsession\u002Fintent` — model router\n- `POST \u002Fchat\u002Fcompletions` — SSE streaming response matching the scenario\n- Agent, session, telemetry, and token endpoints\n\nThe copilot extension connects to this server via `IS_SCENARIO_AUTOMATION=1` mode with `overrideCapiUrl` and `overrideProxyUrl` settings. The `vscode-api-tests` extension must be disabled (`--disable-extension=vscode.vscode-api-tests`) because it contributes a duplicate `copilot` vendor that blocks the real extension's language model provider registration.\n\n### Adding a scenario\n\n1. Add a new entry to the appropriate object (`CONTENT_SCENARIOS`, `TOOL_CALL_SCENARIOS`, or `MULTI_TURN_SCENARIOS`) in `common\u002Fperf-scenarios.js` using the `ScenarioBuilder` API from `common\u002Fmock-llm-server.js`\n2. The scenario is auto-registered by `registerPerfScenarios()` — no manual ID list to update\n3. Run: `npm run perf:chat -- --scenario your-new-scenario --runs 1 --no-baseline --verbose`\n\n## Related skills\n\n- **heap-snapshot-analysis** — When a perf regression or leak check identifies high memory growth, use the heap-snapshot-analysis skill to dig deeper. It can parse `.heapsnapshot` files, compare before\u002Fafter snapshots, group object deltas, and trace retainer paths to find what keeps disposed objects alive. The chat-perf leak check measures overall heap slope; heap-snapshot-analysis finds the specific objects responsible.\n- **auto-perf-optimize** — For launching VS Code, driving a scenario, and capturing heap snapshots or CPU profiles automatically before doing low-level analysis.\n","# Chat Performance Testing\n\n## When to use\n\n- Before\u002Fafter modifying chat rendering code (`chatListRenderer.ts`, `chatInputPart.ts`, markdown rendering)\n- When changing the streaming response pipeline or SSE processing\n- When modifying disposable\u002Flifecycle patterns in chat components\n- To compare performance between two VS Code releases\n- In CI to gate PRs that touch chat UI code\n\n## Quick start\n\n```bash\n# Run perf regression test (compares local dev build vs VS Code 1.115.0):\nnpm run perf:chat -- --scenario text-only --runs 3\n\n# Run all scenarios with no baseline (just measure):\nnpm run perf:chat -- --no-baseline --runs 3\n\n# Compare two local builds (apples-to-apples):\nnpm run perf:chat -- --build \u002Fpath\u002Fto\u002Fbuild-A --baseline-build \u002Fpath\u002Fto\u002Fbuild-B --runs 5\n\n# Build a local production package and compare against a release:\nnpm run perf:chat -- --production-build --baseline-build 1.115.0 --runs 5\n\n# Run memory leak check (10 messages in one session):\nnpm run perf:chat-leak\n\n# Run leak check with more messages for accuracy:\nnpm run perf:chat-leak -- --messages 20 --verbose\n```\n\n## Perf regression test\n\n**Script:** `scripts\u002Fchat-simulation\u002Ftest-chat-perf-regression.js`\n**npm:** `npm run perf:chat`\n\nLaunches VS Code via Playwright Electron, opens the chat panel, sends a message with a mock LLM response, and measures timing, layout, and rendering metrics. By default, downloads VS Code 1.115.0 as a baseline, benchmarks it, then benchmarks the local dev build and compares.\n\n### Key flags\n\n| Flag | Default | Description |\n|---|---|---|\n| `--runs \u003Cn>` | `5` | Runs per scenario. More = more stable. Use 5+ for CI. |\n| `--scenario \u003Cid>` \u002F `-s` | all | Scenario to test (repeatable). See `common\u002Fperf-scenarios.js`. |\n| `--build \u003Cpath\\|ver>` \u002F `-b` | local dev | Build to test. Accepts path or version (`1.110.0`, `insiders`, commit hash). |\n| `--baseline \u003Cpath>` | — | Compare against a previously saved baseline JSON file. |\n| `--baseline-build \u003Cpath\\|ver>` | `1.115.0` | Version or local path to benchmark as baseline. |\n| `--no-baseline` | — | Skip baseline comparison entirely. |\n| `--save-baseline` | — | Save results as the new baseline (requires `--baseline \u003Cpath>`). |\n| `--resume \u003Cpath>` | — | Resume a previous run, adding more iterations to increase confidence. |\n| `--threshold \u003Cfrac>` | `0.2` | Regression threshold (0.2 = flag if 20% slower). |\n| `--production-build` | — | Build a local bundled package via `gulp vscode` for comparison against a release baseline. |\n| `--no-cache` | — | Ignore cached baseline data, always run fresh. |\n| `--force` | — | Skip build mode mismatch confirmation prompt. |\n| `--ci` | — | CI mode: write Markdown summary to `ci-summary.md` (implies `--no-cache`, `--heap-snapshots`, `--cleanup-diagnostics`). |\n| `--heap-snapshots` | — | Take heap snapshots after each run (slow; auto-enabled in `--ci` mode). |\n| `--cleanup-diagnostics` | — | Delete heap snapshots, CPU profiles, and traces to save disk. During runs, only the latest run's files are kept; after comparison, files for non-regressed scenarios are deleted. Auto-enabled in `--ci` mode. |\n| `--setting \u003Ck=v>` | — | Set a VS Code setting override for all builds (repeatable). |\n| `--test-setting \u003Ck=v>` | — | Set a VS Code setting override for the test build only. |\n| `--baseline-setting \u003Ck=v>` | — | Set a VS Code setting override for the baseline build only. |\n| `--verbose` | — | Print per-run details including response content. |\n\n### Comparing two remote builds\n\n```bash\n# Compare 1.110.0 against 1.115.0 (no local build needed):\nnpm run perf:chat -- --build 1.110.0 --baseline-build 1.115.0 --runs 5\n```\n\n### Comparing two local builds\n\nBoth `--build` and `--baseline-build` accept local paths to VS Code executables. This enables apples-to-apples comparisons between any two builds:\n\n```bash\n# Compare two dev builds (e.g. feature branch vs main):\nnpm run perf:chat -- \\\n  --build .build\u002Felectron\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --baseline-build \u002Fpath\u002Fto\u002Fother\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --runs 5\n\n# Compare two production builds:\nnpm run perf:chat -- \\\n  --build ..\u002FVSCode-darwin-arm64-feature\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --baseline-build ..\u002FVSCode-darwin-arm64-main\u002FCode\\ -\\ OSS.app\u002FContents\u002FMacOS\u002FCode\\ -\\ OSS \\\n  --runs 5\n```\n\nLocal path baselines are never cached (the build may change between runs). Version string baselines are cached for reuse.\n\n### Build modes and mismatch detection\n\nThe tool classifies builds into three modes based on the executable path:\n\n| Mode | Source | Characteristics |\n|---|---|---|\n| `dev` | `.build\u002Felectron\u002F` (local dev) | Unbundled sources, `VSCODE_DEV=1`, `NODE_ENV=development`. Higher memory and startup overhead. |\n| `production` | `..\u002FVSCode-\u003Cplatform>-\u003Carch>\u002F` (from `gulp vscode`) | Bundled JS, no dev flags. Matches release characteristics but uses local source. |\n| `release` | `.vscode-test\u002F` (downloaded via `@vscode\u002Ftest-electron`) | Official published build. |\n\nWhen test and baseline builds have different modes (e.g. dev vs release), the tool shows a warning and prompts for confirmation. Use `--force` or `--ci` to skip the prompt.\n\nUsing `--production-build` builds a local bundled package via `gulp vscode` for fair comparison against a release baseline. This eliminates dev-mode overhead while still testing your local changes.\n\n```bash\n# Production build vs release baseline (fair comparison):\nnpm run perf:chat -- --production-build --baseline-build 1.115.0 --runs 5\n```\n\n### Settings overrides\n\nUse `--setting`, `--test-setting`, and `--baseline-setting` to inject VS Code settings into the launched instance. This is useful for A\u002FB testing experimental features:\n\n```bash\n# Enable a feature for the test build only:\nnpm run perf:chat -- --test-setting chat.experimental.incrementalRendering.enabled=true --runs 3\n\n# Compare two builds with different settings:\nnpm run perf:chat -- \\\n  --baseline-build \"..\u002Fvscode2\u002F.build\u002Felectron\u002FCode - OSS.app\u002FContents\u002FMacOS\u002FCode - OSS\" \\\n  --baseline-setting chat.experimental.incrementalRendering.enabled=true \\\n  --test-setting chat.experimental.incrementalRendering.enabled=false \\\n  --runs 3\n\n# Set a value for both builds:\nnpm run perf:chat -- --setting chat.mcp.enabled=false --runs 3\n```\n\nPrecedence: `--test-setting` \u002F `--baseline-setting` override `--setting` for the same key. Values are auto-parsed: `true`\u002F`false` become booleans, numbers become numbers, everything else stays a string.\n\n### Resuming a run for more confidence\n\nWhen results exceed the threshold but aren't statistically significant, the tool prints a `--resume` hint. Use it to add more iterations to an existing run:\n\n```bash\n# Initial run with 3 iterations — may be inconclusive:\nnpm run perf:chat -- --scenario text-only --runs 3\n\n# Add 3 more runs to the same results file (both test + baseline):\nnpm run perf:chat -- --resume .chat-simulation-data\u002F2026-04-14T02-15-14\u002Fresults.json --runs 3\n\n# Keep adding until confidence is reached:\nnpm run perf:chat -- --resume .chat-simulation-data\u002F2026-04-14T02-15-14\u002Fresults.json --runs 5\n```\n\n`--resume` loads the previous `results.json` and its associated `baseline-*.json`, runs N more iterations for both builds, merges rawRuns, recomputes stats, and re-runs the comparison. The updated files are written back in-place. You can resume multiple times — samples accumulate.\n\n### Statistical significance\n\nRegression detection uses **Welch's t-test** to avoid false positives from noisy measurements. A metric is only flagged as `REGRESSION` when it both exceeds the threshold AND is statistically significant (p \u003C 0.05). Otherwise it's reported as `(likely noise — p=X, not significant)`.\n\nWith typical variance (cv ≈ 20%), you need:\n- **n ≥ 5** per build to detect a 35% regression at 95% confidence\n- **n ≥ 10** per build to detect a 20% regression reliably\n\nConfidence levels reported: `high` (p \u003C 0.01), `medium` (p \u003C 0.05), `low` (p \u003C 0.1), `none`.\n\n### Exit codes\n\n- `0` — all metrics within threshold, or exceeding threshold but not statistically significant\n- `1` — statistically significant regression detected, or all runs failed\n\n### Scenarios\n\nScenarios are defined in `scripts\u002Fchat-simulation\u002Fcommon\u002Fperf-scenarios.js` and registered via `registerPerfScenarios()`. There are three categories:\n\n- **Content-only** — plain streaming responses (e.g. `text-only`, `large-codeblock`, `rapid-stream`)\n- **Tool-call** — multi-turn scenarios with tool invocations (e.g. `tool-read-file`, `tool-edit-file`)\n- **Multi-turn user** — multi-turn conversations with user follow-ups, thinking blocks (e.g. `thinking-response`, `multi-turn-user`, `long-conversation`)\n\nRun `npm run perf:chat -- --help` to see the full list of registered scenario IDs.\n\n### Metrics collected\n\n- **Timing:** time to first token, time to complete, time to render complete (includes typewriter animation)\n- **Rendering:** layout count, layout duration (ms), style recalculation count, forced reflows, long tasks (>50ms), long animation frame count and duration\n- **Memory:** heap before\u002Fafter, heap delta post-GC (informational, noisy for single requests)\n- **Extension host:** heap before\u002Fafter\u002Fdelta via CDP inspector\n\n### Regression triggers vs informational metrics\n\nOnly these metrics trigger a regression failure (when they exceed the threshold with statistical significance):\n- `timeToFirstToken`, `timeToComplete` — user-perceived latency\n- `forcedReflowCount` — forced synchronous layouts are always bad\n- `longTaskCount`, `longAnimationFrameCount` — main thread jank\n\nThese are reported but **informational only** (won't fail CI):\n- `layoutCount` — inflated by CSS animations; use `layoutDurationMs` instead\n- `layoutDurationMs` — total layout time from trace (more meaningful than count)\n- `recalcStyleCount` — inflated by CSS animations (compositor-driven, cheap)\n- `timeToRenderComplete` — includes typewriter animation tail\n- Memory\u002Fheap metrics — too noisy for single-request benchmarks\n\n### Statistics\n\nResults use **IQR-based outlier removal** and **median** (not mean) to handle startup jitter. The **coefficient of variation (cv)** is reported — under 15% is stable, over 15% gets a ⚠ warning. Baseline comparison uses **Welch's t-test** on raw run values to determine statistical significance before flagging regressions. Use 5+ runs to get stable results.\n\n## Memory leak check\n\n**Script:** `scripts\u002Fchat-simulation\u002Ftest-chat-mem-leaks.js`\n**npm:** `npm run perf:chat-leak`\n\nLaunches one VS Code session, sends N messages sequentially, forces GC between each, and measures renderer heap and DOM node count. Uses **linear regression** on the samples to compute per-message growth rate, which is compared against a threshold.\n\n### Key flags\n\n| Flag | Default | Description |\n|---|---|---|\n| `--messages \u003Cn>` \u002F `-n` | `10` | Number of messages to send. More = more accurate slope. |\n| `--build \u003Cpath\\|ver>` \u002F `-b` | local dev | Build to test. |\n| `--threshold \u003CMB>` | `2` | Max per-message heap growth in MB. |\n| `--setting \u003Ck=v>` | — | Set a VS Code setting override (repeatable). |\n| `--verbose` | — | Print per-message heap\u002FDOM counts. |\n\n### What it measures\n\n- **Heap growth slope** (MB\u002Fmessage) — linear regression over forced-GC heap samples. A leak shows as sustained positive slope.\n- **DOM node growth** (nodes\u002Fmessage) — catches rendering leaks where elements aren't cleaned up. Healthy chat virtualizes old messages so node count plateaus.\n\n### Interpreting results\n\n- `0.3–1.0 MB\u002Fmsg` — normal (V8 internal overhead, string interning)\n- `>2.0 MB\u002Fmsg` — likely leak, investigate retained objects\n- DOM nodes stable after first message — normal (chat list virtualization working)\n- DOM nodes growing linearly — rendering leak, check disposable cleanup\n\n## Architecture\n\n```\nscripts\u002Fchat-simulation\u002F\n├── common\u002F\n│   ├── mock-llm-server.js    # Mock CAPI server matching @vscode\u002Fcopilot-api URL structure\n│   ├── perf-scenarios.js     # Built-in scenario definitions (content, tool-call, multi-turn)\n│   └── utils.js              # Shared: paths, env setup, stats, launch helpers\n├── config.jsonc              # Default config (baseline version, runs, thresholds)\n├── fixtures\u002F                 # TypeScript fixture files used by tool-call scenarios\n├── test-chat-perf-regression.js\n└── test-chat-mem-leaks.js\n```\n\n### Mock server\n\nThe mock LLM server (`common\u002Fmock-llm-server.js`) implements the full CAPI URL structure from `@vscode\u002Fcopilot-api`'s `DomainService`:\n\n- `GET \u002Fmodels` — returns model metadata\n- `POST \u002Fmodels\u002Fsession` — returns `AutoModeAPIResponse` with `available_models` and `session_token`\n- `POST \u002Fmodels\u002Fsession\u002Fintent` — model router\n- `POST \u002Fchat\u002Fcompletions` — SSE streaming response matching the scenario\n- Agent, session, telemetry, and token endpoints\n\nThe copilot extension connects to this server via `IS_SCENARIO_AUTOMATION=1` mode with `overrideCapiUrl` and `overrideProxyUrl` settings. The `vscode-api-tests` extension must be disabled (`--disable-extension=vscode.vscode-api-tests`) because it contributes a duplicate `copilot` vendor that blocks the real extension's language model provider registration.\n\n### Adding a scenario\n\n1. Add a new entry to the appropriate object (`CONTENT_SCENARIOS`, `TOOL_CALL_SCENARIOS`, or `MULTI_TURN_SCENARIOS`) in `common\u002Fperf-scenarios.js` using the `ScenarioBuilder` API from `common\u002Fmock-llm-server.js`\n2. The scenario is auto-registered by `registerPerfScenarios()` — no manual ID list to update\n3. Run: `npm run perf:chat -- --scenario your-new-scenario --runs 1 --no-baseline --verbose`\n\n## Related skills\n\n- **heap-snapshot-analysis** — When a perf regression or leak check identifies high memory growth, use the heap-snapshot-analysis skill to dig deeper. It can parse `.heapsnapshot` files, compare before\u002Fafter snapshots, group object deltas, and trace retainer paths to find what keeps disposed objects alive. The chat-perf leak check measures overall heap slope; heap-snapshot-analysis finds the specific objects responsible.\n- **auto-perf-optimize** — For launching VS Code, driving a scenario, and capturing heap snapshots or CPU profiles automatically before doing low-level analysis.\n",{"name":5,"description":7},"main","87afe6ce96220accf50a345dea46784c8c9f210e","YYC3-IDE-编辑器内核\u002FYYC3-IDE-编辑器内核-vscode\u002F.github\u002Fskills\u002Fchat-perf",0,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base","https:\u002F\u002Fkb.yyc3.top\u002F","https:\u002F\u002Fgithub.com\u002FYYC-Cube","万象归元于云枢 | 深栈智启新纪元","2026-11-10 10:37:32",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill chat-perf",{"tool":39,"command":40},"bunx","bunx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill chat-perf",{"tool":42,"command":43},"pnpm","pnpm dlx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill chat-perf","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-IDE-编辑器内核\u002FYYC3-IDE-编辑器内核-vscode\u002F.github\u002Fskills\u002Fchat-perf\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CTDWHERCXPQCP0K03A86AS","vercel-sandbox","Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include \"Vercel Sandbox browser\", \"microVM Chrome\", \"agent-browser in sandbox\", \"browser automation on Vercel\", or any task requiring Chrome in a Vercel Sandbox.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fvercel-sandbox\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CTD8D2BNJY54S65M47HEJA","slack","Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include \"check my Slack\", \"what channels have unreads\", \"send a message to\", \"search Slack for\", \"extract from Slack\", \"find who said\", or any task requiring programmatic Slack interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CTCSSB8ZP3Q58C3YZDZK1W","electron","Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include \"automate Slack app\", \"control VS Code\", \"interact with Discord app\", \"test this Electron app\", \"connect to desktop app\", or any task requiring automation of a native Electron application.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Felectron\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CTCBJY76688V4DCZGWFHGQ","dogfood","Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to \"dogfood\", \"QA\", \"exploratory test\", \"find issues\", \"bug hunt\", \"test this app\u002Fsite\u002Fplatform\", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fdogfood\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CTC4H0FFGVEAQR9PA4GA1A","agent-browser","Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to \"open a website\", \"fill out a form\", \"click a button\", \"take a screenshot\", \"scrape data from a page\", \"test this web app\", \"login to a site\", \"automate browser actions\", or any task requiring programmatic web interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fagent-browser\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CTBKVFYBG78FDSABSDJTTQ","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", \"switch to --preset\", and for building a design system or applying a DESIGN.md or brand spec to shadcn\u002Fui.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-UI-界面组件\u002FYYC3-UI-界面组件-ui\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[]]