const { performance } = require('perf_hooks');

function doSomeLongRunningProcess() {
    let result = 0
    for (let i = 0; i < 45000; i++) {
        result += i
    }
}

performance.mark('A')
doSomeLongRunningProcess()
performance.mark('B')

console.log(performance.measure('A to B', 'A', 'B'))
console.log(performance.getEntries())
performance.clearMarks()
performance.clearMeasures()
console.log(performance.getEntries())

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: