Daily Archives: 01.02.2018
React. Benchmarking and optimizing performance
There is a tool called react-addons-perf that should be imported into your project.
1 2 3 |
import Perf from 'react-addons-perf'; window.Perf = Perf; |
After that you can use Perf object in your console. It can tell you about your react performance issues, not including redux. For instance, you can check unnecessary renders or unnecessary change calculations:
1 2 3 4 5 6 |
Perf.start(); // do whatever you want to measure Perf.stop(); Perf.printOperations(); // to show DOM manipulations Perf.printWaisted(); // to show unneeded calculations for components which remained the same afterwards |
Here’s more on that — https://reactjs.org/docs/perf.html. And …