I think the question is straight forward.
I'm looking for something that's similar to window.performance.now() in nodejs V8 engine.
Right now I'm just using:-
var now = Date.now(); //do some processing.. console.log("time elapsed:", Date.now() - now);
But, I read that window.performance.now() is lot more accurate than using the date because of the what's defined here.
The performance. now() method returns a DOMHighResTimeStamp , measured in milliseconds. Note: This feature is available in Web Workers. The returned value represents the time elapsed since the time origin.
Node v8.5.0 has added Performance Timing API, which includes the performance#now()
, e.g.
const { performance } = require('perf_hooks'); console.log('performance', performance.now());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With