Socket
Socket
Sign inDemoInstall

@dxos/benchmark-suite

Package Overview
Dependencies
4
Maintainers
8
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dxos/benchmark-suite

Benchmark suite.


Version published
Weekly downloads
1
Maintainers
8
Created
Weekly downloads
 

Readme

Source

benchmark-suite

Suite to benchmark things.

Build Status Coverage Status npm (scoped) js-semistandard-style standard-readme compliant

Install

$ npm install @dxos/benchmark-suite

Usage

import { Suite } from '@wirelineio/benchmark-suite';

const suite = new Suite();

// prepare your tests
suite.beforeAll(() => {
  // Set an optional context data that will be shared across each benchmark test
  suite.setContext({
    list: [...Array(10000).keys()]
  });
});

suite.test('forEach', () => {
  const { list } = suite.context;
  list.forEach(() => {});
});

suite.test('for-of', () => {
  const { list } = suite.context;
  for (const i of list) {}
});

const results = await suite.run();

suite.print(results);

Prints:

# forEach
ok ~294 μs (0 s + 293701 ns)

# for-of
ok ~498 μs (0 s + 498171 ns)

wins: forEach
ok ~2.45 ms (0 s + 2449887 ns)

API

Contributing

PRs accepted.

License

GPL-3.0 © dxos

FAQs

Last updated on 02 Jun 2020

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc