react-profiling

Profile React rendering, commit duration, and re-render frequency with React DevTools and Profiler APIs.

2|Updated Feb 26, 2024
One-click install
npx skills add https://github.com/rudolfolah/profiling-code --skill react-profiling-rudolfolah
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-profiling
Source: https://github.com/rudolfolah/profiling-code/tree/main/.claude/skills/react-profiling
Command: npx skills add https://github.com/rudolfolah/profiling-code --skill react-profiling-rudolfolah

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React applications often suffer from slow interactions caused by unnecessary re-renders, long commits, or browser-side work, and it is hard to tell which layer is responsible. This Skill provides a structured workflow for gathering the right profiling evidence so performance claims are backed by measurements instead of guesses. ## Core Features & Use Cases - React DevTools Profiler workflow: Record bounded interaction scenarios, inspect commits in order, and attribute renders to specific components to form hypotheses about unstable props, context updates, or missing memoization. - Programmatic <Profiler> measurements: Wrap the smallest relevant subtree with React's Profiler component and record commit phase, actual duration, base duration, and interaction labels for repeatable comparisons. - Browser trace correlation: Align React commit windows with Chrome DevTools Performance traces using User Timing marks to separate render cost from layout, paint, network, and garbage collection. - Use Case: A settings page feels laggy when toggling a filter. Record the interaction in React DevTools Profiler, identify which components re-render unnecessarily, verify the cause in code, apply memoization, then re-record the same scenario to confirm the improvement. ## Quick Start Profile the filter toggle interaction on my settings page with React DevTools Profiler and tell me which components re-render unnecessarily.

Frequently Asked Questions about react-profiling

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

FAQPage Schema
How do I profile React component re-renders?

Use React DevTools Profiler to record a bounded interaction, then inspect commits in order to see which components rendered, how long each commit took, and whether the work was mount or update. Verify the cause in code before changing anything.

How to measure React render time in code with the Profiler component?

Wrap the smallest relevant subtree in React's <Profiler id="..." onRender={...}> component. The onRender callback receives commit phase, actual duration, base duration, start time, and commit time for the wrapped subtree.

React DevTools Profiler vs Chrome DevTools Performance tab?

React DevTools Profiler attributes render work to specific components and commits. Chrome DevTools Performance traces show scripting, layout, paint, network, and scheduling on the browser timeline, but do not identify which React component caused a render.

Should I profile React in development or production mode?

Prefer a production profiling build when the project supports one, because development-only diagnostics can change render cost. Always reproduce the same build, route, data state, viewport, and browser settings that users experience.

Why is my React interaction slow even though commits are fast?

A slow interaction can be dominated by network wait, layout, paint, hydration, garbage collection, or unrelated JavaScript rather than React rendering. Capture a Chrome DevTools Performance trace for the same scenario and align it with the React commit window using User Timing marks.

What are the limitations of React Profiler measurements?

React <Profiler> only measures render commits for the wrapped subtree. It does not capture network, layout, paint, memory retention, or GPU cost, so optimization claims need the same scenario measured before and after the change.