首页 > Web开发 > 详细

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

时间:2020-01-30 23:19:58      阅读:137      评论:0      收藏:0      [点我收藏+]

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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!