Skip to content

Zaur-Lumanov/lightbench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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`))

About

Easy code execution time checking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published