1.0.1 • Published 7 years ago

lightbench v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

lightbench

npm package

Easy code execution time checking.

Installation:

npm i lightbench

Connectivity:

const lightbench = require('lightbench')

Usage

Synchronous code check:

lightbench(func, callback)
  • func - Function for testing
  • callback - The function that will be called after the test function is completed. The argument will be passed the execution time in milliseconds.

Example:

const lightbench = require('lightbench')

lightbench(() => {
	for (let i = 0; i < 1000; i++) {
		console.log(i)
	}
}, (ms) => console.log(`Result: ${ms} ms`))

Synchronous code check:

lightbench()(func, callback)
  • func - Function for testing. In the argument, a callback is sent, which must be executed after the asynchronous code is completed.
  • callback - The function that will be called after the test function is completed. The argument will be passed the execution time in milliseconds.

Example:

const lightbench = require('lightbench')

lightbench()((end) => {
	setTimeout(end, 1500)
}, (ms) => console.log(`Result: ${ms} ms`))