Skip to content

Instantly share code, notes, and snippets.

@srmagura
Created October 21, 2022 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srmagura/e2f8613f82114dd3b6388e17daafe97e to your computer and use it in GitHub Desktop.
Save srmagura/e2f8613f82114dd3b6388e17daafe97e to your computer and use it in GitHub Desktop.
Add up the render times from a React DevTools profiler export
const fs = require("fs");
const path =
"/Users/srmagura/Downloads/profiling-data.10-21-2022.13-06-25.json";
const text = fs.readFileSync(path, { encoding: "utf-8" });
const obj = JSON.parse(text);
const commitData = obj["dataForRoots"][0]["commitData"];
console.log(`${commitData.length} renders`);
const sum = commitData.reduce((acc, cur) => acc + cur.duration, 0);
console.log(`${Math.round(sum)} ms total`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment