mohammadhb
5/27/2019 - 9:47 AM

Performance Checking for Node.JS

const {performance} = require('perf_hooks');

const start = performance.now();

//Your Code Lays Here :)

const end = performance.now();
/*
  cte : Constant to make 0 < (end-start) < 1 when there is no code 
  * it's just for better understanding ( if you dont want it leave it to be )
*/
const cte = 1;
console.log(`Performance : ${(end-start)*cte}`)