How to get the output from console.timeEnd() in JS Console?

后端 未结 4 2091
感情败类
感情败类 2021-01-31 07:50

I\'d like to be able to get the string returned from console.timeEnd(\'t\') in my Google Chrome Javascript Console.

In this example below, I\'d like one var

4条回答
  •  感动是毒
    2021-01-31 08:36

    In Google Chrome 23.0.1262.2 (Official Build 155904) dev, it looks like it's impossible. The only way I found to be able to calculate time with accuracy is to use window.performance.webkitNow()

    Here's a simple example:

    var start = window.performance.now();
    ...
    var end = window.performance.now();
    var time = end - start;
    

    Read more at http://updates.html5rocks.com/2012/08/When-milliseconds-are-not-enough-performance-now

提交回复
热议问题