For those seeking accurate timing information, the use of performance.now() is recommended as a reliable option.
Here's an example from the book Pro TypeScript, specifically Chapter 7 - focusing on performance using performance.now()
:
var startTime = performance.now();
// Code being tested goes here
var elapsedTime = performance.now() - startTtime;
One key advantage of performance time is its microsecond precision and immunity to computer clock adjustments like millisecond corrections.
It's crucial for objects with the same time origin to exhibit monotonically increasing behavior while remaining impervious to system clock changes or skewing.
This feature has been supported in...
- Chrome 20
- Firefox 15
- IE 10
- Opera 15
- Safari 8