@bunchmark/cli

1.0.0-pre-7 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @bunchmark/cli

Weekly Downloads

1

Version

1.0.0-pre-7

License

ISC

Unpacked Size

1.43 MB

Total Files

12

Last publish

Collaborators

  • pygy