Created
October 21, 2022 17:09
-
-
Save srmagura/e2f8613f82114dd3b6388e17daafe97e to your computer and use it in GitHub Desktop.
Add up the render times from a React DevTools profiler export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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