使用
performance.now():
var t0 = performance.now()doSomething() // <---- The function you're measuring time for var t1 = performance.now()console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")
NodeJs:需要导入performance类
使用
console.time:(非标准)(生活水平)
console.time('someFunction')someFunction() // Whatever is timed goes between the two "console.time"console.timeEnd('someFunction')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)