node js 获取程序执行时间 time timeEnd
示例代码:
function getFunRunTime(){
console.time('test');
let temp;
for (let index = 0; index < 10000; index++) {
temp += index
}
// time和timeEnd的参数要相同
console.timeEnd('test');
}
getFunRunTime();
控制台输出:
test: 0.384765625ms