via: https://stackoverflow.com/questions/1003855/how-can-i-benchmark-javascript-code
const timer = function (name) { const start = new Date() return { stop () { const end = new Date() const time = end.getTime() - start.getTime() console.log('Timer:', name, 'finished in', time, 'ms') } } }