πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Sign inDemoInstall
Socket

overtake

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

overtake

NodeJS performance benchmark

0.1.1
latest
Source
npm
Version published
Weekly downloads
3.4K
1.81%
Maintainers
1
Weekly downloads
Β 
Created
Source

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

Keywords

benchmark

FAQs

Package last updated on 07 Mar 2024

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