CLI Reference
Commands
Section titled “Commands”modestbench [pattern..]
Section titled “modestbench [pattern..]”Run benchmarks with powerful discovery and filtering options. The run command is the default and can be omitted.
Basic Usage
Section titled “Basic Usage”# Run all benchmarks matching default pattern (./bench/**/*.bench.{js,mjs,cjs,ts})modestbench
# Run all benchmarks in a directory (searches recursively)modestbench benchmarks/
# Run specific filesmodestbench benchmarks/critical.bench.js
# Run from multiple directoriesmodestbench src/perf/ tests/benchmarks/
# Mix files, directories, and glob patternsmodestbench file.bench.js benchmarks/ "tests/**/*.bench.ts"
# Explicit run command (optional)modestbench run benchmarks/Supported File Extensions
Section titled “Supported File Extensions”- JavaScript:
.js,.mjs,.cjs - TypeScript:
.ts,.mts,.cts
Options
Section titled “Options”--config <path>
Section titled “--config <path>”Specify a custom configuration file path.
modestbench --config ./custom-config.json--iterations <number>
Section titled “--iterations <number>”Number of samples to collect per benchmark task.
modestbench --iterations 5000Higher values provide more accurate results but take longer to complete.
--time <number>
Section titled “--time <number>”Time budget in milliseconds per benchmark task.
modestbench --time 10000--limit-by <mode>
Section titled “--limit-by <mode>”Control how benchmarks are limited. Options:
iterations- Stop after N samples (fast, predictable)time- Run for T milliseconds (consistent time investment)any- Stop when either threshold is reached (default when both specified)all- Require both time AND iterations thresholds
# Explicit controlmodestbench --iterations 500 --time 5000 --limit-by time
# Safety bounds (whichever comes first)modestbench --iterations 1000 --time 10000 --limit-by any
# Statistical rigor (both required)modestbench --iterations 100 --time 2000 --limit-by allSmart Defaults:
- Only
--iterations→ Usesiterationsmode (fast) - Only
--time→ Usestimemode - Both specified → Uses
anymode (whichever comes first) - Neither specified → Uses default iterations (100) with
iterationsmode
--warmup <number>
Section titled “--warmup <number>”Number of warmup iterations before measurement begins.
modestbench --warmup 100Helps stabilize JIT compilation for more consistent results.
--engine <name>
Section titled “--engine <name>”Select the benchmark engine. Options: tinybench (default) or accurate.
# Use the accurate engine for high-precision measurementsnode --allow-natives-syntax ./node_modules/.bin/modestbench --engine accurate
# Use tinybench engine (default)modestbench --engine tinybenchEngine Differences:
tinybench(default): Fast, lightweight engine suitable for development and CI. Uses IQR-based outlier removal.accurate: High-precision engine with V8 optimization guards to prevent JIT compiler interference. Requires--allow-natives-syntaxflag. Recommended for production benchmarks and critical performance measurements.
See the Getting Started guide for detailed comparison.
--timeout <number>
Section titled “--timeout <number>”Maximum time in milliseconds for a single task before timing out.
modestbench --timeout 60000Default: 30000 (30 seconds)
--bail
Section titled “--bail”Stop execution on first benchmark failure.
modestbench --bailUseful in CI/CD to fail fast when performance regressions are detected.
--reporters <reporters>
Section titled “--reporters <reporters>”Comma-separated list of reporters to use.
# Single reportermodestbench --reporters json
# Multiple reporters simultaneouslymodestbench --reporters human,json,csvAvailable reporters:
human- Color-coded terminal output (default for TTY with colors)simple- Plain text output (default for non-TTY environments)json- Structured JSON datacsv- Tabular CSV format
--output <directory>
Section titled “--output <directory>”Directory path for saving benchmark results and reports.
modestbench --reporters json,csv --output ./resultsWhen specified:
- JSON reporter writes to
{output}/results.json - CSV reporter writes to
{output}/results.csv - Human reporter still writes to stdout/stderr
--quiet
Section titled “--quiet”Minimal output mode. Suppresses progress bars and non-essential messages.
modestbench --quiet--verbose
Section titled “--verbose”Detailed output mode with additional debugging information.
modestbench --verbose--tags <tags>
Section titled “--tags <tags>”Run only benchmarks with specific tags (OR logic - matches ANY).
# Single tagmodestbench --tags fast
# Multiple tags (matches ANY)modestbench --tags string,array,algorithmTags cascade from file → suite → task levels. If a benchmark has ANY of the specified tags, it will run.
--exclude-tags <tags>
Section titled “--exclude-tags <tags>”Exclude benchmarks with specific tags.
# Exclude one typemodestbench --exclude-tags slow
# Exclude multiple typesmodestbench --exclude-tags experimental,unstable--concurrent
Section titled “--concurrent”Run benchmark files concurrently (experimental).
modestbench --concurrentComplete Example
Section titled “Complete Example”modestbench \ --config ./config.json \ --iterations 2000 \ --warmup 50 \ --reporters human,json,csv \ --output ./results \ --tags performance,algorithm \ --exclude-tags experimental \ --quiet \ benchmarks/modestbench init
Section titled “modestbench init”Initialize a project with configuration and example benchmarks.
# Interactive initializationmodestbench init
# Specify project typemodestbench init basicmodestbench init advancedmodestbench init library
# Specify config formatmodestbench init --config-type typescriptmodestbench init --config-type jsonmodestbench init --config-type yamlmodestbench init --config-type jsProject Types
Section titled “Project Types”-
basic - Simple setup for small projects
- 100 iterations
- Human reporter
- Minimal configuration
-
advanced - Feature-rich setup
- 1000 iterations
- Warmup enabled
- Human + JSON reporters
- Organized suite structure
-
library - Optimized for library performance testing
- 5000 iterations
- High warmup (100)
- Human + JSON reporters
- Comprehensive suite organization
What It Does
Section titled “What It Does”- Generates a configuration file in your chosen format
- Creates an example benchmark file
- Appends
.modestbench/to.gitignoreto exclude historical data
modestbench history
Section titled “modestbench history”Manage benchmark history and compare results over time.
history list
Section titled “history list”List recent benchmark runs.
modestbench history listhistory show <run-id>
Section titled “history show <run-id>”Show detailed results for a specific run.
modestbench history show run-2025-10-07-001history compare <run-id-1> <run-id-2>
Section titled “history compare <run-id-1> <run-id-2>”Compare two benchmark runs.
modestbench history compare run-2025-10-07-001 run-2025-10-07-002history export
Section titled “history export”Export historical data.
# Export to CSVmodestbench history export --format csv --output results.csv
# Export to JSONmodestbench history export --format json --output results.jsonhistory clean
Section titled “history clean”Clean old benchmark data.
# Clean runs older than 30 daysmodestbench history clean --older-than 30d
# Keep only last 10 runsmodestbench history clean --keep 10
# Clean by sizemodestbench history clean --max-size 100mbGlobal Options
Section titled “Global Options”These options work with all commands:
--help
Section titled “--help”Show help information.
modestbench --helpmodestbench --help # shows run command help (default command)modestbench history --help--version
Section titled “--version”Show version number.
modestbench --versionEnvironment Variables
Section titled “Environment Variables”modestbench respects several environment variables:
Enable debug mode with detailed logging.
DEBUG=1 modestbenchShows full error stack traces and additional debugging information.
Automatically detected CI environment flag.
CI=true modestbenchWhen detected:
- Captures CI provider information
- Stores build details in results
- May adjust defaults for CI-friendly output
NODE_ENV
Section titled “NODE_ENV”Node.js environment mode. Stored in benchmark results for context.
NODE_ENV=production modestbenchFORCE_COLOR / NO_COLOR
Section titled “FORCE_COLOR / NO_COLOR”Control color output in terminal.
# Force color outputFORCE_COLOR=1 modestbench
# Disable color outputNO_COLOR=1 modestbenchConfiguration Priority
Section titled “Configuration Priority”Command-line flags override configuration file settings:
{ "iterations": 1000, "reporters": ["human"]}# CLI flags take precedencemodestbench --iterations 5000 --reporters json# Result: iterations=5000, reporters=["json"]Priority order:
- Default values (lowest)
- Configuration file
- CLI flags (highest)
Examples
Section titled “Examples”Quick Development Testing
Section titled “Quick Development Testing”modestbench --iterations 10 --quietProduction Benchmarking
Section titled “Production Benchmarking”modestbench \ --iterations 5000 \ --warmup 100 \ --reporters human,json,csv \ --output ./resultsCI/CD Integration
Section titled “CI/CD Integration”modestbench \ --reporters json,csv \ --output ./benchmark-results \ --quiet \ --bail \ --tags criticalRegression Testing
Section titled “Regression Testing”# Run current benchmarksmodestbench --reporters json --output ./current
# Compare with baselinemodestbench history compare baseline-run-id $(modestbench history list --format json | jq -r '.[0].id')Next Steps
Section titled “Next Steps”- Learn about Configuration file options
- Understand Output Formats for reporter details
- Explore Advanced Usage for complex scenarios