2 ms·
The article mentions “new Date()” as the alternative to the performance API. Unless you’re supporting IE8 you should prefer Date.now(), which saves you the obje
by yojo 7y ago
The article mentions “new Date()” as the alternative to the performance API. Unless you’re supporting IE8 you should prefer Date.now(), which saves you the object instantiation if you’re just reading out ms.
Also, performance.now (and the date methods) have their precision hamstrung in some browsers for privacy and Spectre mitigation.
Of course, for perf use the dedicated APIs. Just don’t expect microsecond resolution to be accurate.