Skip to content

Instantly share code, notes, and snippets.

@vipulwairagade
Created February 17, 2021 08:05
Show Gist options
  • Save vipulwairagade/9939ae82513d92c8e339ef58c1dea0e5 to your computer and use it in GitHub Desktop.
Save vipulwairagade/9939ae82513d92c8e339ef58c1dea0e5 to your computer and use it in GitHub Desktop.
Find time required for a particular process in node.js
const { PerformanceObserver, performance } = require('perf_hooks');
let t0 = performance.now()
/*
* Do process here for which you need to calculate time
* Example :
* let response = await axios.get()
**/
let t1 = performance.now()
console.log("Process time " + (t1 - t0) + " milliseconds.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment