Skip to content

Architecture

ModestBench is a TypeScript-based benchmarking framework that wraps tinybench to provide structure, CLI tooling, historical tracking, performance budgets, and multiple output formats for JavaScript/TypeScript performance testing. The architecture follows a dependency injection pattern with clear separation of concerns across subsystems.

Core Technology: Node.js 18+, TypeScript, tinybench 2.6.0

Key Dependencies:

  • tinybench - Core benchmarking engine
  • yargs - CLI argument parsing
  • glob - File discovery
  • cosmiconfig - Configuration loading
  • zod - Schema validation

SubsystemPurposeKey FilesStateful?
CLICommand-line interface and command routingcli/index.ts
cli/commands/*.ts
No
CoreBenchmark orchestration and executioncore/engine.ts
core/engines/*.ts
No
ServicesBusiness logic and data managementservices/*.tsMixed
ConfigConfiguration loading and mergingservices/config-manager.tsNo
ProgressReal-time progress trackingservices/progress-manager.tsYes
ReportersOutput formatting (human/JSON/CSV/nyan)reporters/*.tsYes (HumanReporter)
HistoryHistorical benchmark data persistenceservices/history-storage.tsYes
BaselineNamed baseline managementservices/baseline-storage.tsYes
BudgetPerformance budget evaluationservices/budget-evaluator.tsNo
ProfilerCPU profiling and analysisservices/profiler/*.tsNo
AdaptersTest framework integrationadapters/*.tsNo
FormattersHistory output formattingformatters/history/*.tsNo
ErrorsStructured error handlingerrors/*.tsNo
TypesTypeScript interfaces and typestypes/*.tsNo
UtilsShared utilitiesutils/*.tsNo

Entry Point: src/cli/index.ts

The CLI provides the following commands:

CommandDescriptionHandler File
run [pattern..]Run benchmark files (default)cli/commands/run.ts
test <framework>Run test files as benchmarkscli/commands/test.ts
analyze [command]CPU profiling and analysiscli/commands/analyze.ts
baseline <subcommand>Manage performance baselinescli/commands/baseline.ts
history <subcommand>View and manage benchmark historycli/commands/history.ts
init [type]Initialize a new benchmark projectcli/commands/init.ts

The CLI creates a CliContext object containing all initialized services:

export interface CliContext {
readonly abortController: AbortController;
readonly configManager: ConfigurationManager;
readonly engine: BenchmarkEngine;
readonly historyStorage: HistoryStorage;
readonly options: GlobalOptions;
readonly progressManager: ProgressManager;
readonly reporterRegistry: ReporterRegistry;
}

This context is passed to all command handlers, enabling:

  • Testability: Easy to mock dependencies
  • Flexibility: Services can be swapped without changing commands
  • Separation of Concerns: Each service has a single responsibility

ModestBench uses an abstract base class pattern to support multiple benchmark execution strategies. The architecture consists of three layers:

Abstract Base Class: src/core/engine.ts

  • Provides all orchestration logic: file discovery, validation, suite/task iteration, progress tracking, reporter lifecycle
  • Defines single abstract method: executeBenchmarkTask() for concrete engines to implement
  • Handles setup/teardown, error recovery, history storage, budget evaluation, and result aggregation

Concrete Implementations: src/core/engines/

  1. TinybenchEngine - Wraps external tinybench library
  2. AccurateEngine - Custom measurement implementation with V8 optimization guards

3.2 TinybenchEngine: Wrapper Implementation

Section titled “3.2 TinybenchEngine: Wrapper Implementation”

Location: src/core/engines/tinybench-engine.ts

Strategy: Thin wrapper around the tinybench library

How It Works:

  1. Creates a Bench instance from tinybench with configured time/iterations
  2. Adds the benchmark function to the bench instance
  3. Runs the benchmark (tinybench handles timing internally)
  4. Extracts raw samples from tinybench results
  5. Post-processes samples with IQR outlier removal
  6. Calculates statistics from cleaned samples
  7. Returns standardized TaskResult

Key Features:

  • Leverages tinybench’s mature timing and iteration logic
  • Handles tinybench’s “Invalid array length” errors for extremely fast operations (automatic retry with minimal time)
  • Supports abort signals for task cancellation
  • Progress updates during execution (500ms interval)

Configuration Mapping (limitBy modes):

ModestBench ConfigTinybenchEngine Behavior
limitBy: 'all'Both time AND iterations must complete (default)
limitBy: 'any'Minimal time (1ms), iterations-limited
limitBy: 'time'Time-limited, minimal iterations (1)
limitBy: 'iterations'Iterations-limited, minimal time (1ms)

Location: src/core/engines/accurate-engine.ts

Strategy: Custom measurement using Node.js process.hrtime.bigint and V8 optimization guards

Inspiration: Adapted from bench-node measurement techniques

How It Works:

  1. Check V8 intrinsics availability (requires --allow-natives-syntax flag)
  2. Calculate adaptive iterations based on quick 30-iteration test
  3. Run optional warmup (min 10 samples or warmup time)
  4. Main benchmark loop:
    • Execute function N times in a batch (max 10,000 per round)
    • Time each batch with process.hrtime.bigint
    • Calculate per-operation duration
    • Push samples to array
    • Adjust iterations for next round based on remaining time
  5. Apply IQR outlier removal to raw samples
  6. Calculate statistics from cleaned samples
  7. Return standardized TaskResult

V8 Optimization Guards (when available):

// Created using V8 intrinsics
const DoNotOptimize = new Function('x', 'return x');
const NeverOptimize = new Function(
'fn',
'%NeverOptimizeFunction(fn); return fn;',
);
// Prevents V8 from optimizing away benchmark code
for (let i = 0; i < iterations; i++) {
const result = fn();
guardedDoNotOptimize(result); // Forces V8 to keep result
}

Key Features:

  • Higher accuracy through V8 optimization guards (prevents JIT artifacts)
  • Adaptive iteration calculation matches operation speed to target duration
  • Nanosecond precision using BigInt hrtime
  • Fallback mode when --allow-natives-syntax not available
  • Bounded iterations (max 10,000 per round) to prevent memory issues
  • Progress updates every 100 samples
  • Full abort signal support

Requirements:

  • Node.js >= 20
  • --allow-natives-syntax flag (optional but recommended)
  • Falls back gracefully without flag (prints warning once)

Trade-offs vs TinybenchEngine:

AspectTinybenchEngineAccurateEngine
AccuracyGood (tinybench’s timing)Excellent (V8 guards)
SetupNo special flags neededRequires --allow-natives-syntax for best results
SpeedFastSlower (more iterations)
MaturityProduction-ready (tinybench)Custom implementation
MaintenanceExternal dependencyInternal code

Both engines use the same statistical processing pipeline (src/core/stats-utils.ts):

  1. IQR Outlier Removal - Removes samples outside 1.5 * IQR range
  2. Statistics Calculation - mean, stdDev, variance, CV, percentiles (p95, p99)

This ensures consistent result quality regardless of engine choice.


Location: src/adapters/

ModestBench can capture test definitions from popular test frameworks and convert them to benchmarks, allowing you to measure test execution performance.

FrameworkAdapter FileRegistration File
Mochamocha-adapter.tsN/A (global hooks)
node:testnode-test-adapter.tsnode-test-register.ts
AVAava-adapter.tsava-register.ts
Jestjest-adapter.tsjest-register.ts

Types: src/adapters/types.ts

interface TestFrameworkAdapter {
readonly framework: TestFramework;
capture(filePath: string): Promise<CapturedTestFile>;
}
interface CapturedTestFile {
readonly filePath: string;
readonly framework: TestFramework;
readonly rootSuites: CapturedSuite[];
readonly rootTests: CapturedTest[];
}

Conversion Flow:

  1. Adapter intercepts test framework globals (describe, it, test)
  2. Test definitions are captured without execution
  3. capturedToBenchmark() converts to ModestBench format
  4. Hooks (beforeEach, afterEach) are wrapped into benchmark setup/teardown
Terminal window
# Run Mocha tests as benchmarks
modestbench test mocha test/*.spec.js
# Run node:test tests with custom iterations
modestbench test node-test test/*.test.js --iterations 500
# Run AVA tests
modestbench test ava test/*.js

Location: src/services/budget-evaluator.ts, src/types/budgets.ts

Performance budgets allow setting thresholds for benchmark results, enabling CI/CD integration for performance regression detection.

interface Budget {
absolute?: AbsoluteBudget;
relative?: RelativeBudget;
}
interface AbsoluteBudget {
maxTime?: number; // Max mean execution time (ns)
minOpsPerSec?: number; // Min operations per second
maxP99?: number; // Max 99th percentile (ns)
}
interface RelativeBudget {
maxRegression?: number; // Max regression vs baseline (decimal, e.g., 0.10 = 10%)
baseline?: string; // Named baseline to compare against
}
class BudgetEvaluator {
evaluateRun(
budgets: Record<string, Budget>,
taskResults: Map<TaskId, TaskResult>,
baselineData?: Map<TaskId, BaselineSummaryData>,
): BudgetSummary;
}

Location: src/services/baseline-storage.ts, src/cli/commands/baseline.ts

Baselines are named snapshots of benchmark results that serve as reference points for relative budget comparisons.

File: .modestbench.baselines.json

interface BaselineStorage {
version: string;
default?: string; // Default baseline name
baselines: Record<string, BaselineReference>;
}
interface BaselineReference {
name: string;
runId: RunId;
date: Date;
commit?: string;
branch?: string;
summary: Record<TaskId, BaselineSummaryData>;
}
Terminal window
# Save current run as baseline
modestbench baseline set production-v1.0
# Set as default baseline
modestbench baseline set v1.0 --default
# List all baselines
modestbench baseline list
# Show baseline details
modestbench baseline show production-v1.0
# Delete a baseline
modestbench baseline delete old-baseline
# Analyze history to suggest budgets
modestbench baseline analyze --runs 20 --confidence 0.95

Location: src/services/profiler/, src/cli/commands/analyze.ts, src/types/profiler.ts

The profiling system allows CPU profiling of arbitrary commands and analysis of existing .cpuprofile files to identify benchmark candidates.

ServiceLocationPurpose
runWithProfilingservices/profiler/profile-runner.tsExecute command with —cpu-prof
parseProfileservices/profiler/profile-parser.tsParse .cpuprofile files
filterProfileservices/profiler/profile-filter.tsFilter and sort functions
Terminal window
# Profile a command
modestbench analyze "npm test"
# Analyze existing profile
modestbench analyze --input profile.cpuprofile
# Filter by file pattern
modestbench analyze "npm test" --filter-file "src/**/*.ts"
# Show top N functions
modestbench analyze "npm test" --top 50 --min-percent 1.0

Location: src/reporters/

ReporterFileDescription
HumanReporterhuman.tsRich terminal output with colors/progress
JsonReporterjson.tsMachine-readable JSON output
CsvReportercsv.tsTabular CSV format
SimpleReportersimple.tsPlain text, no colors (CI-friendly)
NyanReporternyan.tsAnimated nyan cat rainbow reporter
ProfileHumanReporterprofile-human.tsHuman-readable CPU profile output
interface Reporter {
onStart(run: BenchmarkRun): Promise<void> | void;
onEnd(run: BenchmarkRun): Promise<void> | void;
onError(error: Error): Promise<void> | void;
onTaskResult(result: TaskResult): Promise<void> | void;
// Optional methods
onFileStart?(file: string): Promise<void> | void;
onFileEnd?(result: FileResult): Promise<void> | void;
onSuiteInit?(
suite: string,
taskNames: readonly string[],
): Promise<void> | void;
onSuiteStart?(suite: string): Promise<void> | void;
onSuiteEnd?(result: SuiteResult): Promise<void> | void;
onTaskStart?(task: string): Promise<void> | void;
onProgress?(state: ProgressState): Promise<void> | void;
onBudgetResult?(summary: BudgetSummary): Promise<void> | void;
}

The history system provides persistent storage of benchmark runs with querying, trend analysis, cleanup, and export capabilities.

Implementation: src/services/history-storage.ts

Location: src/formatters/history/

FormatterFilePurpose
ListFormatterlist.tsFormat run listings
ShowFormattershow.tsFormat single run details
CompareFormattercompare.tsFormat run comparisons
TrendsFormattertrends.tsFormat trend analysis results
Visualizationvisualization.tsTerminal charts and graphs

Location: src/services/history/trend-analysis.ts

class TrendAnalysisService {
analyzeTrends(runs: BenchmarkRun[]): TrendsResult;
}
interface TrendsResult {
trends: TrendData[];
summary: {
totalTasks: number;
improvingTasks: number;
stableTasks: number;
degradingTasks: number;
};
regressions: TrendData[];
lowConfidenceRegressions: TrendData[];
timespan: { start: Date; end: Date };
runs: number;
}

Trend Classification:

  • Improving: Negative slope (values decreasing = faster)
  • Stable: Slope within 5% of mean
  • Degrading: Positive slope (values increasing = slower)
Terminal window
# List recent runs
modestbench history list --since "1 week ago"
# Show run details
modestbench history show abc123
# Compare two runs
modestbench history compare abc123 def456
# Analyze trends
modestbench history trends --since "1 month ago"
# Clean old history
modestbench history clean --max-runs 50 --yes
# Export to file
modestbench history export -o history.json

Location: src/errors/

All errors extend ModestBenchError and include error codes and documentation URLs.

FileError Types
base.tsModestBenchError, ModestBenchAggregateError
budget.tsBudgetExceededError
cli.tsInvalidArgumentError, InvalidDateFormatError, UnknownError
configuration.tsConfigLoadError, ConfigNotFoundError, ConfigValidationError
execution.tsBenchmarkExecutionError, TaskExecutionError, TimeoutError
file.tsFileDiscoveryError, FileLoadError, FileNotFoundError
reporter.tsReporterAlreadyRegisteredError, UnknownReporterError
storage.tsStorageError, StorageCorruptionError, StorageIndexError
validation.tsSchemaValidationError, StructureValidationError

All error codes are defined in src/constants.ts:

export const ErrorCodes = {
BUDGET_EXCEEDED: 'ERR_MB_BUDGET_EXCEEDED',
CLI_INVALID_ARGUMENT: 'ERR_MB_CLI_INVALID_ARGUMENT',
CONFIG_LOAD_FAILED: 'ERR_MB_CONFIG_LOAD_FAILED',
EXECUTION_TIMEOUT: 'ERR_MB_EXECUTION_TIMEOUT',
FILE_NOT_FOUND: 'ERR_MB_FILE_NOT_FOUND',
STORAGE_FAILED: 'ERR_MB_STORAGE_FAILED',
// ... etc
} as const;

Location: src/services/config-manager.ts, src/config/schema.ts

Uses cosmiconfig for configuration discovery and Zod for validation.

const searchPlaces = [
'package.json',
'.modestbenchrc',
'.modestbenchrc.json',
'.modestbenchrc.yaml',
'.modestbenchrc.yml',
'modestbench.config.json',
'modestbench.config.yaml',
'modestbench.config.yml',
'modestbench.config.js',
'modestbench.config.mjs',
'modestbench.config.ts',
];

Location: src/config/schema.ts, src/config/budget-schema.ts

// Main configuration schema (Zod)
const ModestBenchConfigSchema = z.object({
pattern: z.union([z.string(), z.array(z.string())]),
exclude: z.array(z.string()).optional(),
iterations: z.number().int().positive(),
time: z.number().positive(),
warmup: z.number().int().nonnegative(),
timeout: z.number().positive(),
bail: z.boolean(),
limitBy: z.enum(['time', 'iterations', 'any', 'all']),
budgets: z.record(BudgetSchema).optional(),
// ... more options
});

Location: src/index.ts

ModestBench exports a complete programmatic API:

// Main bootstrap function
export { bootstrap as modestbench } from './bootstrap.js';
// Core engine
export { ModestBenchEngine } from './core/engine.js';
export { AccurateEngine, TinybenchEngine } from './core/engines/index.js';
// Statistical utilities
export { calculateStatistics, removeOutliersIQR } from './core/stats-utils.js';
// Services
export { ModestBenchConfigurationManager } from './services/config-manager.js';
export { BenchmarkFileLoader } from './services/file-loader.js';
export { FileHistoryStorage } from './services/history-storage.js';
export { ModestBenchProgressManager } from './services/progress-manager.js';
export {
ModestBenchReporterRegistry,
BaseReporter,
CompositeReporter,
} from './services/reporter-registry.js';
// Profiler services
export { runWithProfiling } from './services/profiler/profile-runner.js';
export { parseProfile } from './services/profiler/profile-parser.js';
export { filterProfile } from './services/profiler/profile-filter.js';
// Reporters
export { HumanReporter } from './reporters/human.js';
export { JsonReporter } from './reporters/json.js';
export { CsvReporter } from './reporters/csv.js';
export { ProfileHumanReporter } from './reporters/profile-human.js';
// Error classes
export * from './errors/index.js';
// All types
export * from './types/index.js';
// Utilities
export { findPackageRoot } from './utils/package.js';
import { TinybenchEngine, bootstrap, HumanReporter } from 'modestbench';
// Bootstrap all dependencies
const deps = bootstrap();
// Create engine
const engine = new TinybenchEngine(deps);
// Register reporters
engine.registerReporter('human', new HumanReporter({ color: true }));
// Execute benchmarks
const result = await engine.execute({
pattern: '**/*.bench.js',
iterations: 1000,
});

src/
├── adapters/ # Test framework adapters
│ ├── ava-adapter.ts
│ ├── ava-hooks.ts
│ ├── ava-register.ts
│ ├── jest-adapter.ts
│ ├── jest-hooks.ts
│ ├── jest-register.ts
│ ├── mocha-adapter.ts
│ ├── node-test-adapter.ts
│ ├── node-test-hooks.ts
│ ├── node-test-register.ts
│ └── types.ts
├── bootstrap.ts # Dependency injection setup
├── cli/
│ ├── commands/
│ │ ├── analyze.ts # CPU profiling command
│ │ ├── baseline.ts # Baseline management
│ │ ├── history.ts # History commands
│ │ ├── init.ts # Project initialization
│ │ ├── run.ts # Main benchmark runner
│ │ └── test.ts # Test-as-benchmark command
│ └── index.ts # CLI entry point
├── config/
│ ├── budget-schema.ts # Budget configuration schema
│ └── schema.ts # Main config schema (Zod)
├── constants.ts # Exit codes, error codes, defaults
├── core/
│ ├── benchmark-schema.ts # Benchmark file schema
│ ├── engine.ts # Abstract benchmark engine
│ ├── engines/
│ │ ├── accurate-engine.ts
│ │ ├── index.ts
│ │ └── tinybench-engine.ts
│ ├── output-path-resolver.ts
│ └── stats-utils.ts # Statistical calculations
├── errors/ # Structured error classes
│ ├── base.ts
│ ├── budget.ts
│ ├── cli.ts
│ ├── configuration.ts
│ ├── execution.ts
│ ├── file.ts
│ ├── index.ts
│ ├── reporter.ts
│ ├── storage.ts
│ └── validation.ts
├── formatters/ # History output formatters
│ └── history/
│ ├── base.ts
│ ├── compare.ts
│ ├── list.ts
│ ├── show.ts
│ ├── trends.ts
│ └── visualization.ts
├── index.ts # Public API exports
├── reporters/
│ ├── csv.ts
│ ├── human.ts
│ ├── index.ts
│ ├── json.ts
│ ├── nyan.ts # Nyan cat reporter
│ ├── profile-human.ts # CPU profile reporter
│ └── simple.ts # Plain text reporter
├── services/
│ ├── baseline-storage.ts # Named baseline management
│ ├── budget-evaluator.ts # Performance budget evaluation
│ ├── config-manager.ts # Configuration loading
│ ├── file-loader.ts # Benchmark file discovery
│ ├── history/
│ │ ├── comparison.ts
│ │ ├── models.ts
│ │ ├── query.ts
│ │ └── trend-analysis.ts
│ ├── history-storage.ts # Run persistence
│ ├── profiler/
│ │ ├── profile-filter.ts
│ │ ├── profile-parser.ts
│ │ └── profile-runner.ts
│ ├── progress-manager.ts
│ └── reporter-registry.ts
├── types/
│ ├── budgets.ts # Budget-related types
│ ├── core.ts # Core types (Run, Result, etc.)
│ ├── index.ts
│ ├── interfaces.ts # Service interfaces
│ ├── profiler.ts # Profiler types
│ └── utility.ts # Utility types
└── utils/
├── ansi.ts # ANSI color utilities
├── identifiers.ts # ID generation
├── package.ts # Package.json utilities
└── type-guards.ts # Type guard functions

SubsystemPrimary FileLinesKey Classes/Functions
CLI Entrysrc/cli/index.ts~1250cli(), main(), createCliContext()
Run Commandsrc/cli/commands/run.ts~500handleRunCommand()
Test Commandsrc/cli/commands/test.ts~550handleTestCommand()
Analyze Commandsrc/cli/commands/analyze.ts~200handleAnalyzeCommand()
Baseline Commandsrc/cli/commands/baseline.ts~400handleSetCommand(), handleListCommand()
Engine Basesrc/core/engine.ts~1000ModestBenchEngine (abstract)
Tinybenchsrc/core/engines/tinybench-engine.ts~350TinybenchEngine
Accuratesrc/core/engines/accurate-engine.ts~410AccurateEngine
Statssrc/core/stats-utils.ts~150calculateStatistics, removeOutliersIQR
Configsrc/services/config-manager.ts~470ModestBenchConfigurationManager
File Loadersrc/services/file-loader.ts~420BenchmarkFileLoader
Historysrc/services/history-storage.ts~610FileHistoryStorage
Baselinesrc/services/baseline-storage.ts~200BaselineStorageService
Budgetsrc/services/budget-evaluator.ts~185BudgetEvaluator
Progresssrc/services/progress-manager.ts~415ModestBenchProgressManager
Trend Analysissrc/services/history/trend-analysis.ts~240TrendAnalysisService
Profile Runnersrc/services/profiler/profile-runner.ts~125runWithProfiling()
Human Reportersrc/reporters/human.ts~600HumanReporter
Nyan Reportersrc/reporters/nyan.ts~410NyanReporter
Simple Reportersrc/reporters/simple.ts~550SimpleReporter
Adapters Typessrc/adapters/types.ts~290TestFrameworkAdapter, capturedToBenchmark
Typessrc/types/~700Interface definitions
Errorssrc/errors/~500All error classes

Total Source Code: ~11,000 lines


VariablePurposeLocationDefaultImpact
DEBUGShow stack traces on errorssrc/cli/index.tsundefinedError verbosity
CIDetect CI environmentsrc/core/engine.ts'false'Enable CI info collection
NODE_ENVEnvironment modesrc/core/engine.ts'development'Stored in environment info
FORCE_COLORForce color outputsrc/reporters/human.tsundefinedOverride color detection
NO_COLORDisable color outputsrc/reporters/human.tsundefinedOverride color detection
GitHub ActionsCI provider detectionsrc/core/engine.tsN/ASee below

When GITHUB_ACTIONS is set, captures:

GitHub VariableModestBench FieldPurpose
GITHUB_RUN_NUMBERbuildNumberJob number
GITHUB_REPOSITORYUsed to build buildUrle.g., owner/repo
GITHUB_RUN_IDUsed to build buildUrlJob run ID
GITHUB_REF_NAMEbranchBranch or PR ref
GITHUB_EVENT_NAMEDetermines pullRequestEvent type
GITHUB_SHAcommitCommit SHA

Why: Support multiple benchmark execution strategies without code duplication
How: Abstract base class with single executeBenchmarkTask() hook
Trade-off: Easier to add new engines, but requires understanding the abstraction

Why: Enables testing and flexibility
How: Services passed via bootstrap() and createCliContext()
Trade-off: More verbose setup for programmatic use

Why: Prevent accidental mixing of RunId and TaskId
How: TypeScript branded types (string & { __brand: 'RunId' })
Trade-off: Requires explicit creation functions

Why: Standard tool used by ESLint, Prettier, Babel
How: Automatic discovery of config files in multiple formats
Trade-off: External dependency, but well-maintained

Why: Type-safe schema validation with inference
How: Schemas define configuration structure and generate types
Trade-off: Runtime overhead, but provides better error messages

Why: Clear separation between CLI, core, and services
How: All services in src/services/ directory
Trade-off: More files, but better organization


Location: /test/

Structure:

  • unit/ - Pure function tests
  • integration/ - Component interaction tests
  • contract/ - Interface compliance tests
Test FileCoverage
test/contract/tinybench-engine.test.tsTinybenchEngine implementation
test/contract/accurate-engine.test.tsAccurateEngine implementation
test/integration/engine-comparison.test.tsEngine compatibility
test/integration/test_reporters.test.tsReporter output
test/integration/test_configuration.test.tsConfig loading

Both concrete engines (TinybenchEngine and AccurateEngine) are tested against the same contract to ensure API compatibility.


TermDefinition
Benchmark RunComplete execution of all discovered benchmark files
SuiteCollection of related benchmark tasks
TaskSingle benchmark operation (one function to measure)
ReporterOutput formatter (human, JSON, CSV, nyan, simple)
History StoragePersistent benchmark result storage
BaselineNamed reference snapshot for budget comparisons
BudgetPerformance threshold (absolute or relative)
Progress StateReal-time execution progress tracking
TaskIdUnique identifier: {filePath}/{suiteName}/{taskName}
RunId7-character alphanumeric run identifier
TinyBenchExternal benchmark library wrapped by TinybenchEngine
AccurateEngineCustom benchmark engine with V8 optimization guards
TinybenchEngineEngine that wraps the tinybench library
IQR FilteringInterquartile Range outlier removal for sample cleanup
V8 IntrinsicsLow-level V8 functions for optimization control
CliContextDependency injection container for CLI commands
Test AdapterConverts test framework definitions to benchmarks
Trend AnalysisStatistical analysis of performance changes over time

This architectural overview provides a comprehensive understanding of ModestBench’s internal structure, design decisions, and capabilities. The system is well-architected with clear separation of concerns through the engine abstraction pattern, service layer consolidation, and comprehensive feature set for performance testing.