Skip to content

modestbench

A full-ass benchmarking framework for Node.js

Fast & Accurate

High-precision timing with advanced statistical analysis. Choose between the fast tinybench engine or the accurate engine with V8 optimization guards and IQR outlier removal.

Multiple Output Formats

Generate human-readable, simple text, JSON, and CSV reports simultaneously. Auto-detects environment for optimal output.

Historical Tracking

Store and compare benchmark results over time. Track performance trends and catch regressions early.

Profile & Discover

Identify hot code paths with built-in profiling. Run any command with V8’s profiler to find benchmark candidates automatically.

CLI & API

Powerful command-line interface with sensible defaults, plus a programmatic API for advanced usage.

TypeScript Support

Write benchmarks in JS or TS.

benchmarks/example.bench.js
export default {
'Array.push()': () => {
const arr = [];
for (let i = 0; i < 1000; i++) {
arr.push(i);
}
return arr;
},
'Array spread': () => {
let arr = [];
for (let i = 0; i < 1000; i++) {
arr = [...arr, i];
}
return arr;
},
};
Terminal window
# Run all benchmarks
modestbench
# Run with specific options
modestbench --iterations 5000 --reporter human --reporter json

modestbench provides a powerful benchmarking framework with dual engines and rich features:

  • Dual engines - Fast tinybench for development, accurate for precision measurements
  • Advanced statistics - IQR outlier removal, coefficient of variation, percentiles
  • Project structure - Organized benchmark files and suites
  • Configuration management - Multiple formats (JSON, YAML, JS, TS)
  • Rich CLI - Discover and run benchmarks with powerful options
  • Multiple reporters - Get output in the format you need
  • Historical data - Track performance over time automatically
  • Tagging and filtering - Run exactly what you need

Whether you’re optimizing a hot code path, comparing algorithm implementations, or setting up performance regression testing in CI, modestbench has you covered.