JSFiddle - React, Tailwind, and code Playground
by shapeshifta
HTML
<!doctype html>
<html>
<head>
</head>
<body onload="init()">
<script>
function init() {
performance.mark("startTask1");
doTask1(); // Some developer code
performance.mark("endTask1");
performance.mark("startTask2");
doTask2(); // Some developer code
performance.mark("endTask2");
measurePerf();
}
function measurePerf() {
var perfEntries = performance.getEntries("marks");
for (i = 0; i < perfEntries.length; i++){
if (window.console){
console.log("Name: " + perfEntries[i].name +
" Entry Type: " + perfEntries[i].entryType +
" Start Time: " + perfEntries[i].startTime +
" Duration: " + perfEntries[i].duration + "\n");
}
}
}
</script>
</body>
</html>