lightbench

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i lightbench

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • zaur_lumanov