Filtering Commits by Duration Threshold
What you'll learn: How to filter out fast commits and focus only on slow ones that exceed a configurable time threshold.
After recording a profile session, the React DevTools Profiler may show dozens or even hundreds of commits—many of which rendered in a fraction of a millisecond and aren't worth investigating. Filtering by duration threshold helps you cut through the noise and focus exclusively on the slow commits that are actually hurting your app's performance.
How It Works
At the top of the Profiler, you'll see a filter control (often a slider or input field) that lets you set a minimum commit duration. For example, if you set the threshold to 10ms, the Profiler will hide all commits that took less than 10 milliseconds to complete. Only commits that met or exceeded this duration remain visible in the flame graph and ranked views.
This is like turning on noise-canceling headphones in a crowded room—suddenly, you only hear the conversations (or in this case, commits) that matter.
Why This Matters
Fast commits aren't performance problems. If a commit rendered in 2ms, optimizing it won't provide meaningful user benefit. By filtering these out, you:
- Save time: You skip over hundreds of unimportant commits.
- Focus on real bottlenecks: You immediately see which interactions caused slow renders.
- Prioritize optimizations: You know exactly where your effort will have impact.
When to Use It
Start with a low threshold (e.g., 5ms) and gradually increase it if you still see too many commits. For most apps, commits over 16ms (one frame at 60fps) are the ones worth investigating first.
Key Takeaway: Filtering commits by duration threshold lets you ignore fast renders and zero in on the slow commits that actually impact user experience—turning hours of profiling data into actionable insights in seconds.