How to use the react-addons-perf.getWasted function in react-addons-perf

To help you get started, we’ve selected a few react-addons-perf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mui-org / material-ui / test / integration / fixtures / perf / TimeWaster.js View on Github external
endTest() {
    const measurements = Perf.getLastMeasurements();
    const wasted = Perf.getWasted(measurements);

    const summary = {};

    summary.hasWastedTime = component => {
      const result = find(wasted, n => n.key.indexOf(`> ${component}`));
      if (result) {
        return (
          `${result.key} wasted ${result.inclusiveRenderDuration}ms ` +
          `across ${result.renderCount} renders`
        );
      }
      return false;
    };

    return this.props.onComplete(summary);
  }