bahmutov/code-snippets

console.time is not as accurate as performance.now

SgtPooki opened this issue · 2 comments

Run this in your console and see for yourself. The difference is minor, but it is there.

(function(){
    var now;
    var total;
    for(var i = 0; i < 10; i++) {
        console.time('test');
        console.timeEnd('test');

        now = performance.now();
        total = performance.now()-now;
        console.log(total);
    }
})();

Good observation. I would appreciate if you forked, changed the timing calls and submitted a pull request. Promise to merge it quickly.

cool, merged