🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

lightbench

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightbench

Easy code execution time checking.

1.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

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

Keywords

lightbench

FAQs

Package last updated on 13 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts