Benny (version 3.7.1) is a straightforward benchmarking framework for JavaScript and TypeScript, designed to simplify the process of performance measurement in Node.js environments. It abstracts the complexity of the underlying `benchmark.js` library, offering a more intuitive API for defining and running benchmarks. Key features include native support for synchronous and asynchronous code, per-case setup and teardown functionalities, the ability to selectively run or skip test cases, and robust result handling with options to save output to JSON, CSV, or interactive HTML charts. It provides sensible defaults, but allows for detailed configuration when needed, and integrates well with IDEs through built-in type definitions. Benny targets Node.js version 12 and above and maintains a stable release cadence. Its primary differentiator is simplifying the API over raw `benchmark.js` while retaining its powerful measurement capabilities.
npm install bennyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining a benchmark suite with two cases, executing them, printing results to the console, and saving the results to a JSON file and an interactive HTML chart.
Run benchmarks on dedicated machines or in controlled CI/CD environments. Consider running multiple times to observe consistency.
Return promises from async setup/teardown functions and benchmark cases. Ensure all async operations complete before the measurement for a given cycle is considered done.
Always include `b.cycle()` and `b.complete()` after your `b.add()` calls within the `b.suite()` definition.
Ensure your Node.js environment is version 12 or newer, as specified in the package's engine requirements.
Use `const b = require('benny')` for CommonJS or `import b from 'benny'` for ESM, and then call methods like `b.suite()`, `b.add()`, etc.Install the package using `npm install benny --save-dev` or `yarn add benny --dev`.
Isolate the critical section of code for benchmarking. Use `b.beforeEach()` and `b.afterEach()` for setup/teardown that should not be timed. Adjust `minTime` or `minSamples` options within `b.add` or `b.configure` for longer, more stable runs if needed.
No dependency data recorded yet.