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

@indutny/bencher

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@indutny/bencher

Simple benchmarking tool

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
335
increased by12.42%
Maintainers
1
Weekly downloads
 
Created
Source

@indutny/bencher

npm CI Status

Simple JavaScript benchmarking tool inspired by my bad understanding of how Criterion.rs works.

Disclaimer

Let's be honest, I'm terrible at statistics. This approach that I took here is probably incorrect, but the results appear to be stable enough so I'm happy to use it for my personal projects.

Any ideas on improving the algorithm are very welcome!

Installation

npm install -g @indutny/bencher

Usage

// benchmark.js
export const name = 'runner';

// Function to benchmark
export default () => {
  let sum = 0;
  for (let i = 0; i < 1e6; i++) {
    sum += i;
  }

  // Make sure to return a side-effect value (possibly a result of the
  // run) to ensure that the pure function calls are not optimized out by the
  // JIT compiler.
  return sum;
};
$ bencher benchmark.js
runner: 1’037.8 ops/sec (±18.8, p=0.001, n=98)

LICENSE

This software is licensed under the MIT License.

Keywords

FAQs

Package last updated on 25 Dec 2022

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