Finding React Components to Optimize

Kyle Robertson
Nov 29, 2017 · 5 min read
Image for post
Image for post
SOUND FOREST by WILLPOWER STUDIOS (WILLIAM ISMAEL, CC BY-ND 2.0)

Tools to Debug Performance

Perf

if (process.env.NODE_ENV === 'development' && window) {
window.Perf = require('react-addons-perf');
}
> Perf.start()… (perform some state-changing user actions in the browser)> Perf.stop()

printWasted

Image for post
Image for post
Example output of the printWasted method. The third column shows the amount of wasted time spent rendering components that were ultimately discarded by React’s reconciliation process. The fourth and fifth columns show the number of instances of a component on the page and the number of times that component rendered, respectively.

printOperations

Image for post
Image for post
Partial output of printOperations, from the same segment of profile data that was used to generate the printWasted table above.

Riipen Engineering

A discussion of Riipen engineering and technology

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store