const {performance} = require('perf_hooks');
let startTime = performance.now();
const extractedData = await readFunction()
let endTime = performance.now();
let timeTaken = endTime-startTime
I want to calculate time taken to execute readFunction(). Is this good approach to calculate total time taken to execute readFunction? Also on console.log(startTime) it gives some value instead of starting from 0.
So to get precise value should I do the following step or above step is enough to get precise time in milisecond.
const {performance} = require('perf_hooks');
let startTime = 0
const extractedData = await readFunction()
let endTime = performance.now();
let timeTaken = endTime-startTime
Is timeTaken value in milisecond? If anyone needs any further information please let me know.