Socket
Book a DemoInstallSign in
Socket

@bunchmark/cli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bunchmark/cli

The bunchmark CLI runner

latest
Source
npmnpm
Version
1.0.0-pre-7
Version published
Maintainers
1
Created
Source

@bunchmark/cli

@bunchmark/cli lets one bencmark JS code from the CLI

Quick demo

Usage

In a nutshell:

// benchmark.js
import {run} from '@bunchmark/cli'

await run({
    preamble: () => {
        let result; setTimeout(()=>console.log(result))
        const ary = Array.from({length: 100}, ()=>Math.random())
    }
    tasks: [
        {
            name: "for loop",
            run(){
                for (let i = 0; i < ary.length; i++) result = ary[i]
            },
        },
        {
            name: "ary.forEach",
            run(){
                ary.forEach(x=>result = x) 
            },
        },
        {
            name: "for of",
            run(){
                for (const x of ary) result = x
            },
        }
    ]
})

process.exit(0)

TODO: document every possible option

Keywords

benchmark

FAQs

Package last updated on 28 Dec 2023

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