Executor
Technical deep-dive on benchmark orchestration, calibration, and measurement collection
Technical deep-dive on benchmark orchestration, calibration, and measurement collection
The poly-bench-executor crate orchestrates benchmark execution. It spawns isolated subprocesses per language, runs warmup and timed iterations, collects timing and memory measurements, and aggregates results. This page covers the scheduler, compile cache, workspace management, and calibration flow.
The executor is responsible for:
runMode is timeBased, determine iteration count to hit target timeThe scheduler (poly-bench-executor/src/scheduler.rs) implements the main run loop:
run(spec, suite, options) — Entry point for a single benchmark suiteindicatifThe scheduler calls into poly-bench-runtime to generate code, build, and execute. It collects Measurement objects (timing, memory) and aggregates them into BenchmarkResult and SuiteResults.
poly-bench-runtime to generate language-specific sourcego build, cargo build, node for TS)warmup iterations (configurable) to prime cachesiterations (or calibrated count) and measurecount > 1, run multiple times and aggregatepoly-bench-reporterWhen the suite uses timeBased run mode:
iterations = targetTime / (pilot_time / 100)minIterations and maxIterations from configThis ensures fast operations get enough iterations for stable timing, and slow operations don't run indefinitely.
The compile cache (poly-bench-executor/src/compile_cache.rs) caches compiled binaries:
poly-bench cache stats shows cache sizepoly-bench cache clear invalidates cachepoly-bench cache clean removes entire .polybench/ workspaceIf source is unchanged, the executor skips recompilation.
The workspace module (poly-bench-executor/src/workspace.rs) manages:
go:./my-mod, ts:./frontend)For EVM benchmarks, the executor supports AnvilService: