0.1.1 • Published 2 months ago

overtake v0.1.1

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
2 months ago

Overtake

Performance benchmark for NodeJS

Build Status NPM version Downloads Coverage Status Maintainability Snyk

Table of Contents

Features

  • CLI
  • TypeScript support
  • Running in thread worker

Installing

Using yarn:

$ yarn add -D overtake

Using npm:

$ npm install -D overtake

Examples

Public interface

Create a benchmark in __benchmarks__ folder

benchmark('mongodb vs postgres', () => {
  // initialize a context for benchmark
  setup(async () => {
    const { Client } = await import('pg');
    const postgres = new Client();
    await postgres.connect();

    const { MongoClient } = await import('mongob');
    const mongo = new MongoClient(uri);
    await mongo.connect();

    return { postgres, mongo };
  });

  measure('mongodb inserts', ({ mongo } /* context */, next) => {
    // prepare a collection
    const database = mongo.db('overtake');
    const test = database.collection('test');

    return (data) => test.insertOne(data).then(next);
  });

  measure('postgres inserts', ({ postgres } /* context */, next) => {
    // prepare a query
    const query = 'INSERT INTO overtake(value) VALUES($1) RETURNING *';

    return (data) => postgres.query(query, [data.value]).then(next);
  });

  teardown(async ({ mongo, postgres }) => {
    await postgres.end();
    await mongo.end();
  });

  perform('simple test', 100000, [[{ value: 'test' }]]);
});

Make sure you have installed used modules and run

yarn overtake

or

npx overtake

Inline support

npx overtake -i "class A{}" -i "function A() {}" -i "A = () => {};" -c 20000
⭐ Script
  ⇶ Suite
    ➤ Perform
      ✓ Measure class A{}
        ┌─────────┬──────────┬──────────┬──────────┬───────────┬───────┐
        │ (index) │   med    │   p95    │   p99    │   total   │ count │
        ├─────────┼──────────┼──────────┼──────────┼───────────┼───────┤
        │ 0.0005  │ 0.000551 │ 0.001493 │ 0.002344 │ 16.506385 │ 20000 │
        └─────────┴──────────┴──────────┴──────────┴───────────┴───────┘
      ✓ Measure function A() {}
        ┌─────────┬─────────┬────────┬──────────┬──────────┬───────┐
        │ (index) │   med   │  p95   │   p99    │  total   │ count │
        ├─────────┼─────────┼────────┼──────────┼──────────┼───────┤
        │ 0.00008 │ 0.00009 │ 0.0003 │ 0.000441 │ 2.875578 │ 20000 │
        └─────────┴─────────┴────────┴──────────┴──────────┴───────┘
      ✓ Measure A = () => {};
        ┌─────────┬─────────┬──────────┬──────────┬─────────┬───────┐
        │ (index) │   med   │   p95    │   p99    │  total  │ count │
        ├─────────┼─────────┼──────────┼──────────┼─────────┼───────┤
        │ 0.00008 │ 0.00012 │ 0.000331 │ 0.000601 │ 3.42556 │ 20000 │
        └─────────┴─────────┴──────────┴──────────┴─────────┴───────┘

Please take a look at benchmarks to see more examples

Showcase

Already measured performance

License

License Apache-2.0 Copyright (c) 2021-present Ivan Zakharchanka

0.1.1

2 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.1-rc3

2 years ago

0.0.1-rc1

2 years ago

0.0.1-rc2

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.6

2 years ago

0.7.0

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.1-1

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago