问题:
I need to get execution time in milliseconds. 我需要获取执行时间(以毫秒为单位)。
I originally asked this question back in 2008. The accepted answer then was to use new Date().getTime() However, we can all agree now that using the standard performance.now() API is more appropriate. 我最初是在2008年问这个问题的。当时接受的答案是使用new Date()。getTime()。但是,我们现在都同意使用标准performance.now() API更合适。 I am therefore changing the accepted answer to this one. 因此,我正在改变对此的公认答案。
解决方案:
参考一: https://stackoom.com/question/1Jen/如何测量函数执行所需的时间参考二: https://oldbug.net/q/1Jen/How-to-measure-time-taken-by-a-function-to-execute
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4313831