3 回答
TA贡献1816条经验 获得超4个赞
console.time()
, console.profile()
performance.now()
TA贡献1895条经验 获得超3个赞
console.time()
& console.timeEnd()
我如何使用它的例子:
var iterations = 1000000;console.time('Function #1');for(var i = 0; i < iterations; i++ ){ functionOne();};console.timeEnd('Function #1')console.time('Function #2');for(var i = 0; i < iterations; i++ ){ functionTwo();};console.timeEnd('Function #2')
TA贡献1891条经验 获得超3个赞
var start = +new Date(); // log start timestampfunction1();var end = +new Date(); // log end timestampvar diff = end - start;
添加回答
举报