Socket
Socket
Sign inDemoInstall

perfect-benchmark

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    perfect-benchmark

The only Node.js benchmarking library you'll need


Version published
Maintainers
1
Install size
1.91 MB
Created

Readme

Source

perfect-benchmark

The only Node.js benchmarking library you'll need.

Example screenshot

Installation

npm install perfect-benchmark

Usage

Basic Usage

The usage of perfect-benchmark is super simple. An example can be seen below:

const benchmark = require("perfect-benchmark");

benchmark(callback => {
        // do complex computing here...

        callback();
}, "complex stuff");

Advanced Usage

By default the function passed to benchmark is called 25 times, as can be seen in the screenshot above. If you need it to be executed a different amout of times, you can set the amount via benchmark's third parameter.

If you want to specify a callback to be called after the benchmark has completed, you can pass it as a fourth parameter.

The following example demonstrates these two features.

const benchmark = require("perfect-benchmark");

benchmark(callback => {
        // do complex computing here...

        callback();
}, "complex stuff", 5, () => {  // execute 5 times
    console.log("benchmarking complete!");
});

Keywords

FAQs

Last updated on 14 Mar 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc