HTML5 | Performance

为了得到脚本运行的准确耗时,需要一个高精度时间戳。传统的做法是使用Date对象的getTime方法 var start = new Date().getTime(); // doSomething() var now = new Date().getTime(); var latency = now - start; console.log("任务运行时间:" + latency); 传统的缺点:
相关文章
相关标签/搜索