paint-brush
[javascript] measuring performance of time, CPU, RAM and heap of codeby@peterchang_82818
4,237 reads
4,237 reads

[javascript] measuring performance of time, CPU, RAM and heap of code

by August 11th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

It is an tool of measuring performance of time, CPU, RAM and heap of javascript code
featured image - [javascript] measuring performance of time, CPU, RAM and heap of code
 HackerNoon profile picture

It is an tool of measuring performance of time, CPU, RAM and heap of javascript code

Install

$ npm install --save js-meter

Usage




**const jm = require('js-meter')**const isPrint = trueconst isKb = true // or Mb





**const m = new jm({isPrint, isKb})**for(var i=0; i<10000; i++){Math.random()}

const meter = m.stop()






// RAM : 1080 kb// HeapTotal : 1024 kb// HeapUsed : -7.2265625 kb// External : 0 kb// CPU : 3.344 ms// Spend time : 1004 ms

Example

https://github.com/wahengchang/js-meter/blob/master/example.js

Reference:

https://www.npmjs.com/package/js-meter