@alireza-ab/performance-check

1.0.0 • Public • Published

Performance Check

the simple script for check the performance of javascript code with Date and performance and console.time APIs.

Installation

npm install @alireza-ab/performance-check

Usage

const Performance = require("@alireza-ab/performance-check");
let forArr = [];
Performance.start("for loop");
for (let i = 0; i < 1000; i++) {
	forArr.push(i);
}
Performance.end("for loop");

//			||
//			||
//		    \/

// performance of for loop:
//   performance interface: (n)ms
//   Date library: (n)ms
//   for loop: (n)ms

let whileArr = [];
let i = 0;
Performance.start("while loop");
while (i < 1000) {
	whileArr.push(i);
	i++;
}
Performance.end("while loop");

//			||
//			||
//		    \/

// performance of while loop:
//   performance interface: (n)ms
//   Date library: (n)ms
//   while loop: (n)ms

if the parameter not passed

let forArr = [];
Performance.start();
for (let i = 0; i < 1000; i++) {
	forArr.push(i);
}
Performance.end();

//			||
//			||
//		    \/

// performance of 1st code:
//   performance interface: (n)ms
//   Date library: (n)ms
//   1st code: (n)ms

License

Performance-check is available under the MIT license.

Package Sidebar

Install

npm i @alireza-ab/performance-check

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.3 kB

Total Files

3

Last publish

Collaborators

  • alireza-ab