Output Formats
modestbench supports multiple output formats through its reporter system. You can use multiple reporters simultaneously to get results in different formats.
Default Reporter Selection
Section titled “Default Reporter Selection”modestbench automatically selects the appropriate reporter based on your environment:
- Interactive terminals (TTY with color support):
humanreporter with colors and progress bars - Non-TTY environments (CI/CD, piped output):
simplereporter with plain text output - Forced color mode (
FORCE_COLOR=1):humanreporter even in non-TTY environments
You can always override the default by explicitly specifying --reporters.
Human Reporter
Section titled “Human Reporter”The human reporter provides color-coded terminal output with real-time progress bars and formatted results. This is the default when running in an interactive terminal (TTY) with color support.
Human Reporter Features
Section titled “Human Reporter Features”- Real-time progress bars - Visual feedback during benchmark execution
- Color-coded results - Green for pass, red for fail, cyan for info
- Performance summaries - Operations per second, mean time, standard deviation
- Environment information - Node.js version, platform, CPU, memory
- Structured output - File → Suite → Task hierarchy
Human Reporter Example Output
Section titled “Human Reporter Example Output”🚀 ModestBench
Environment: Node.js: v24.10.0 Platform: darwin arm64 CPU: Apple M4 Max (16 cores) Memory: 48.0 GB
Found 1 benchmark file(s)
▶ benchmarks/example.bench.js
▶ Array Operations ✓ Array.push() 810.05μs ±2.45% (1.23M ops/sec) ✓ Array spread 81.01ms ±4.12% (12.34K ops/sec) ✓ 2 passed
✓ All 2 tasks passed
📊 Results
✓ All tests passed: 2📁 Files: 1📊 Suites: 1⏱️ Duration: 1.82s
🎉 All benchmarks completed successfully!Human Reporter Usage
Section titled “Human Reporter Usage”# Human reporter is defaultmodestbench
# Explicitly specifymodestbench --reporters human
# Quiet mode (suppresses progress, keeps results)modestbench --reporters human --quietOutput Streams
Section titled “Output Streams”- stdout - Final results and summaries
- stderr - Progress bars and real-time updates
Simple Reporter
Section titled “Simple Reporter”The simple reporter provides clean, text-only output without colors or progress bars. This is the default in non-TTY environments (CI/CD, piped output) or when FORCE_COLOR is not set.
Simple ReporterFeatures
Section titled “Simple ReporterFeatures”- Plain text output - No ANSI colors or escape codes
- No progress bars - Clean output suitable for logs and pipes
- Structured results - Same hierarchy as human reporter (File → Suite → Task)
- Machine-readable - Perfect for parsing and CI/CD logs
Simple Reporter Example Output
Section titled “Simple Reporter Example Output”modestbench
Environment: Node.js: v24.10.0 Platform: darwin arm64 CPU: Apple M4 Max (16 cores) Memory: 48.0 GB
Found 1 benchmark file(s)
> benchmarks/example.bench.js
> Array Operations ✓ Array.push() 810.05μs ±2.45% (1.23M ops/sec) ✓ Array spread 81.01ms ±4.12% (12.34K ops/sec) ✓ 2 passed
✓ All 2 tasks passed
Results
✓ All tests passed: 2Files: 1Suites: 1Duration: 1.82s
All benchmarks completed successfully!Simple Reporter Usage
Section titled “Simple Reporter Usage”# Simple reporter is default in non-TTY environmentsmodestbench | tee results.log
# Explicitly specify simple reportermodestbench --reporters simple
# Force human reporter in non-TTY (requires FORCE_COLOR=1)FORCE_COLOR=1 modestbench --reporters humanWhen to Use
Section titled “When to Use”- CI/CD pipelines - Clean logs without ANSI codes
- Piped output -
modestbench | grep "passed" - Log files - Readable output without color codes
- Automated parsing - Consistent text format
JSON Reporter
Section titled “JSON Reporter”The JSON reporter outputs structured data perfect for programmatic analysis, CI/CD integration, and historical tracking.
Output Structure
Section titled “Output Structure”{ "config": { "iterations": 1000, "time": 1000, "warmup": 50, "timeout": 30000, "bail": false, "limitBy": "iterations" }, "environment": { "nodeVersion": "v24.10.0", "platform": "darwin", "arch": "arm64", "cpu": { "model": "Apple M4 Max", "cores": 16, "speed": 3200 }, "memory": { "total": 51539607552, "totalGB": 48.0 }, "env": { "CI": "false", "NODE_ENV": "development" } }, "results": [ { "file": "benchmarks/example.bench.js", "suite": "Array Operations", "task": "Array.push()", "status": "passed", "opsPerSecond": 1234567.89, "stats": { "mean": 0.00081005, "min": 0.000785, "max": 0.000853, "stdDev": 0.00002, "variance": 0.0000004, "p95": 0.00083, "p99": 0.000845, "marginOfError": 2.45, "iterations": 1000 }, "tags": ["array", "fast"] }, { "file": "benchmarks/example.bench.js", "suite": "Array Operations", "task": "Array spread", "status": "passed", "opsPerSecond": 12345.67, "stats": { "mean": 0.08101, "min": 0.078, "max": 0.085, "stdDev": 0.00334, "variance": 0.00001116, "p95": 0.084, "p99": 0.0848, "marginOfError": 4.12, "iterations": 1000 }, "tags": ["array", "slow"] } ], "run": { "id": "run-2025-10-07-001", "startTime": "2025-10-07T10:30:00.000Z", "endTime": "2025-10-07T10:30:15.420Z", "duration": 15420, "status": "completed" }, "summary": { "totalFiles": 1, "totalSuites": 1, "totalTasks": 2, "passedTasks": 2, "failedTasks": 0, "skippedTasks": 0 }}Field Reference
Section titled “Field Reference”Run Information
Section titled “Run Information”id- Unique run identifierstartTime- ISO 8601 timestamp when run startedendTime- ISO 8601 timestamp when run completedduration- Total duration in millisecondsstatus- Run status:"completed","failed", or"interrupted"
Environment Information
Section titled “Environment Information”nodeVersion- Node.js version stringplatform- Operating system platformarch- CPU architecturecpu.model- CPU model namecpu.cores- Number of CPU corescpu.speed- CPU speed in MHzmemory.total- Total memory in bytesmemory.totalGB- Total memory in GB (formatted)env.CI- CI environment detectedenv.NODE_ENV- Node.js environment mode
Task Results
Section titled “Task Results”file- Benchmark file pathsuite- Suite nametask- Task namestatus- Task status:"passed","failed", or"skipped"opsPerSecond- Operations per second (throughput)stats.mean- Mean execution time (seconds)stats.min- Minimum execution timestats.max- Maximum execution timestats.stdDev- Standard deviationstats.variance- Variancestats.p95- 95th percentilestats.p99- 99th percentilestats.marginOfError- Margin of error percentagestats.iterations- Actual iterations completedtags- Array of task tags
JSON Reporter Usage
Section titled “JSON Reporter Usage”# JSON output to stdoutmodestbench --reporters json
# JSON output to filemodestbench --reporters json --output ./results# Creates: ./results/results.json
# Multiple reportersmodestbench --reporters human,json --output ./resultsIntegration Examples
Section titled “Integration Examples”jq Processing
Section titled “jq Processing”# Extract task names with ops/secmodestbench --reporters json | jq '.results[] | {task: .task, opsPerSecond}'
# Find slowest tasksmodestbench --reporters json | jq '.results | sort_by(.opsPerSecond) | .[0:5]'
# Calculate average ops/secmodestbench --reporters json | jq '[.results[].opsPerSecond] | add / length'Node.js Script
Section titled “Node.js Script”import { readFileSync } from 'fs';
const results = JSON.parse(readFileSync('./results/results.json', 'utf8'));
// Check for performance regressionsconst baseline = JSON.parse(readFileSync('./baseline.json', 'utf8'));
for (const result of results.results) { const baselineResult = baseline.results.find( (r) => r.file === result.file && r.task === result.task, );
if (baselineResult) { const regression = (baselineResult.opsPerSecond - result.opsPerSecond) / baselineResult.opsPerSecond;
if (regression > 0.1) { console.error( `⚠️ ${result.task}: ${(regression * 100).toFixed(1)}% slower`, ); process.exit(1); } }}CSV Reporter
Section titled “CSV Reporter”The CSV reporter outputs tabular data suitable for spreadsheets, data analysis tools, and long-term tracking.
Output Format
Section titled “Output Format”file,suite,task,status,opsPerSecond,mean,min,max,stdDev,variance,p95,p99,marginOfError,iterations,tagsbenchmarks/example.bench.js,Array Operations,Array.push(),passed,1234567.89,0.00081005,0.00078500,0.00085300,0.00002000,0.0000004,0.00083000,0.00084500,2.45,1000,"array,fast"benchmarks/example.bench.js,Array Operations,Array spread,passed,12345.67,0.08101000,0.07800000,0.08500000,0.00334000,0.00001116,0.08400000,0.08480000,4.12,1000,"array,slow"Column Reference
Section titled “Column Reference”| Column | Description | Units |
|---|---|---|
file | Benchmark file path | string |
suite | Suite name | string |
task | Task name | string |
status | Task status | passed, failed, skipped |
opsPerSecond | Operations per second | number |
mean | Mean execution time | seconds |
min | Minimum execution time | seconds |
max | Maximum execution time | seconds |
stdDev | Standard deviation | seconds |
variance | Variance | seconds² |
p95 | 95th percentile | seconds |
p99 | 99th percentile | seconds |
marginOfError | Margin of error | percentage |
iterations | Actual iterations | number |
tags | Comma-separated tags | string |
CSV Reporter Usage
Section titled “CSV Reporter Usage”# CSV output to stdoutmodestbench --reporters csv
# CSV output to filemodestbench --reporters csv --output ./results# Creates: ./results/results.csv
# Multiple reportersmodestbench --reporters human,csv --output ./resultsAnalysis Examples
Section titled “Analysis Examples”Excel/Google Sheets
Section titled “Excel/Google Sheets”- Run benchmarks:
modestbench --reporters csv --output ./results - Import
results.csvinto Excel or Google Sheets - Create pivot tables, charts, and statistical analysis
Python Analysis
Section titled “Python Analysis”import pandas as pdimport matplotlib.pyplot as plt
# Load CSVdf = pd.read_csv('results.csv')
# Plot ops/sec comparisondf.plot(x='task', y='opsPerSecond', kind='bar', title='Benchmark Performance Comparison')plt.ylabel('Operations per Second')plt.xticks(rotation=45)plt.tight_layout()plt.savefig('benchmark-comparison.png')
# Statistical summaryprint(df.describe())
# Find outliersoutliers = df[df['marginOfError'] > 5]print(f"Tasks with high variance: {outliers['task'].tolist()}")Historical Tracking
Section titled “Historical Tracking”#!/bin/bash# Track performance over time
DATE=$(date +%Y-%m-%d)modestbench --reporters csv --output "./history/${DATE}"
# Append to master CSVtail -n +2 "./history/${DATE}/results.csv" >> ./history/all-results.csvUsing Multiple Reporters
Section titled “Using Multiple Reporters”Run multiple reporters simultaneously to get output in different formats:
modestbench --reporters human,json,csv --output ./resultsThis creates:
- Human output to terminal (stdout/stderr)
./results/results.json./results/results.csv
Common Combinations
Section titled “Common Combinations”Development
Section titled “Development”# Human output only for quick feedbackmodestbench# JSON + CSV for analysis (simple reporter used automatically)modestbench --reporters json,csv --output ./results --quiet
# Or let auto-detection handle itmodestbench --output ./resultsDocumentation
Section titled “Documentation”# All formats for comprehensive reportingmodestbench --reporters human,json,csv --output ./benchmark-resultsReporter Behavior
Section titled “Reporter Behavior”When --output is Specified
Section titled “When --output is Specified”- JSON reporter: Writes to
{output}/results.json - CSV reporter: Writes to
{output}/results.csv - Human/Simple reporters: Still write to stdout/stderr
When --output is NOT Specified
Section titled “When --output is NOT Specified”- JSON reporter: Writes to stdout
- CSV reporter: Writes to stdout
- Human/Simple reporters: Write to stdout/stderr
Quiet Mode
Section titled “Quiet Mode”The --quiet flag affects the human and simple reporters:
- Suppresses progress bars and status messages (stderr)
- Keeps final results output
- Does NOT affect JSON or CSV output
Next Steps
Section titled “Next Steps”- Learn about Configuration for reporter setup
- See CLI Reference for command-line options
- Explore Advanced Usage for complex scenarios