cpu-profile-analysis

Analyze V8 CPU profiles and Chrome DevTools trace files to find performance bottlenecks.

1|Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Niiihuel/openide --skill cpu-profile-analysis-niiihuel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpu-profile-analysis
Source: https://github.com/Niiihuel/openide/tree/main/vscode/.github/skills/cpu-profile-analysis
Command: npx skills add https://github.com/Niiihuel/openide --skill cpu-profile-analysis-niiihuel

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Performance profile files (.cpuprofile and Trace-.json) are massive, dense JSON structures that are impractical to inspect manually, making it hard to pinpoint slow functions, long tasks, and rendering bottlenecks in VS Code or Electron applications. ## Core Features & Use Cases - CPU Profile Analysis: Parse V8 sampling profiler data to compute self-time per function, identify activity regions, and compare code paths between implementations. - DevTools Trace Analysis: Extract user timing marks, long tasks, layout/paint events, GC pressure, and input latency from Chrome Trace Event Format files across Renderer, Browser, and GPU processes. - Huge File Handling: Buffer-based parsing strategies for profiles exceeding V8's ~512MB string limit. - Use Case: Given a 150MB Trace-.json from a slow VS Code startup, identify which functions dominated the main thread, when user timing milestones fired, and which tasks blocked rendering for over 50ms. ## Quick Start Analyze the attached Trace-2024.json file and tell me which functions consumed the most CPU time and what caused the long tasks on the renderer main thread.

Frequently Asked Questions about cpu-profile-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze a .cpuprofile file to find slow functions?▼

Parse the JSON to build a node map from the nodes array, then walk samples and timeDeltas to compute self-time per function. Sort functions by self-time descending to find the top cost centers, filtering out idle, program, and garbage collector frames.

What is the difference between a .cpuprofile and a Trace-*.json file?▼

A .cpuprofile contains only V8 sampling profiler data (nodes, samples, timeDeltas). A Trace-*.json uses the Chrome Trace Event Format and additionally includes layout/paint events, user timing marks, GC events, input events, and multi-process data from Renderer, Browser, and GPU processes.

Why does JSON.parse fail on large trace files?▼

V8 cannot create strings larger than roughly 512MB, so readFileSync with utf8 encoding fails on huge profiles. Read the file as a raw Buffer instead, scan for JSON key boundaries by bytes, and parse small sub-buffer sections individually.

How do I find long tasks blocking the main thread in a Chrome trace?▼

Filter traceEvents for RunTask entries with phase X on the CrRendererMain thread where dur exceeds 50000 microseconds. Sort by duration descending to surface the tasks that blocked rendering the longest.

Can I extract CPU profile data from a DevTools trace file?▼

Yes. Trace files embed the full CPU profile as Profile and ProfileChunk events in the disabled-by-default-v8.cpu_profiler category. Merge the nodes, samples, and timeDeltas from all chunks to reconstruct a complete cpuprofile-equivalent structure.

Why do some function names look wrong in sampling profiler output?▼

Sampling profilers only capture functions on the stack at each tick, so exact names are unreliable, and bundled code may have mangled names. Use sets of related marker functions and cross-reference callFrame.lineNumber with source maps.