node js 获取程序执行时间 time timeEnd

时间:2020-01-30 23:19:58   收藏:0   阅读:137

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

原文:https://www.cnblogs.com/mengfangui/p/12244255.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!