1.0.0-pre-7 • Published 4 months ago

@bunchmark/cli v1.0.0-pre-7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

@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