cpu-profile-analysis

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

Updated Sep 3, 2026
One-click install
npx skills add https://github.com/az0512124155azz-sys/CodeForge --skill cpu-profile-analysis-az0512124155azz-sys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpu-profile-analysis
Source: https://github.com/az0512124155azz-sys/CodeForge/tree/main/.github/skills/cpu-profile-analysis
Command: npx skills add https://github.com/az0512124155azz-sys/CodeForge --skill cpu-profile-analysis-az0512124155azz-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Performance profile files like .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. ## 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. - 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 for files exceeding V8's ~512MB string limit, with embedded ProfileChunk reconstruction. - Use Case: Given a 200MB Trace-.json from a slow VS Code session, identify which functions blocked the main thread, when user timing milestones fired, and how much time went to GC. ## Quick Start Analyze the attached Trace-2024.json file and show me the longest main-thread tasks and top functions by self time.

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 from VS Code?▼

Parse the JSON to build a node map from the nodes array, then walk the samples array to compute self-time per function using timeDeltas. Sort functions by self-time descending to find the top CPU consumers and group samples into time buckets to identify activity regions.

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

A .cpuprofile contains only V8 sampling profiler data (nodes, samples, timeDeltas). A Trace-*.json uses the Chrome Trace Event Format with a traceEvents array covering CPU samples, layout, paint, GC, user timing marks, 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 in a Chrome DevTools trace?▼

Filter traceEvents for entries named RunTask with phase X and dur greater than 50000 microseconds on the CrRendererMain thread. Sort by duration descending to surface the tasks blocking the main thread 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 under the disabled-by-default-v8.cpu_profiler category. Merge the nodes, samples, and timeDeltas from all chunks sharing the same profile id, then analyze them like a standard .cpuprofile.