JSFiddle - React, Tailwind, and code Playground

HTML

<div id="l">
</div>

JavaScript

var l = document.getElementById("l");
function reportTime() {
    var el = document.createElement("p");
    el.textContent += (new Date()).toISOString(); 
    l.appendChild(el);
    
}
function doWork() {
    var dummy = [];
    for (i=0; i<10000; i++) {
        dummy.push(Math.random());
    }
    dummy.sort();
}

function startTimer() {
    setInterval(function() { reportTime(); doWork(); },
                1000);
}

(function() {
    var runs = [];
    for (var i=0; i<4; i++) {
        var time = performance.now();
        doWork();
        time = performance.now() - time;
        runs.push(time);
    }
    var el = document.createElement("p");
    console.log(runs);
    el.textContent = "Work duration: " +
        Math.min.apply(null, runs).toFixed(2) + "/" +
        (runs.reduce(
            function (a,b) { return a+b; }
        )/runs.length).toFixed(2) + "/" +
        Math.max.apply(null, runs).toFixed(2);
    l.appendChild(el);
}());

setTimeout(startTimer, 1000-(new Date()).getMilliseconds());