Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quick-bench

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quick-bench

JavaScript Quick Benchmark Tool

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status Coverage Status

quick-bench

JavaScript Quick Benchmark Tool

Requirements

  • NodeJS v5.11.x or higher
  • NPM

See ./package.json

Installation

Source available on GitHub or install module via NPM:

$ npm install quick-bench

Usage

After requiring quick-benchmark create a new instance. Call the start method, log some events, then call the end method and finally the results method to obtain quick benchmarks for JavaScript code.

var Benchmark = require('quick-bench')

var benchmark = new Benchmark()

benchmark.start() // time is recorded in ms

// todo some application code

benchmark.event('eventLabelOne')

benchmark.event('eventLabelOne') // events should occur many times to get useful benchmarks

// todo some more application code

benchmark.event('eventLabelTwo') // n number of events can be logged

// todo perhaps some more code

var results = benchmark.results() // automatically calls benchmark.end()

The above will set the results variable equal to an object with the following format:

{
    elapsedTime: milliseconds,
    events: {
        eventLabelOne: {
            total: 2,
            perSecond: total / (elapsedTime / 1000)
        },
        eventLabelTwo: {
            total: 1,
            perSecond: total / (elapsedTime / 1000)
        },
    }
}

That's it! As the module name implies this package is designed for quick benchmarks.

License

MIT

Keywords

FAQs

Package last updated on 28 Nov 2016

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc