Skip to content

Local performance measurements ​

These are local maintainer measurements produced by scripts/benchmark.py, not universal performance guarantees. They use the system GCC offline so the numbers measure CLAP/Ninja orchestration rather than a first-time toolchain download.

  • recorded: 2026-12-02T23:50:20.269174+00:00
  • machine: Linux 6.8.0-1060-aws x86_64, Python 3.10.12, CPUs 8
  • compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0
  • repetitions per scenario: 3
ScenarioMedianMinMaxMeaning
raw-compiler-cold0.032s0.031s0.033sone direct GCC compile/link invocation without CLAP
direct-cold0.098s0.098s0.099sfirst CLAP build of a fresh two-source direct project
direct-noop0.074s0.072s0.075sunchanged Ninja rebuild check
direct-incremental0.100s0.098s0.113srebuild after changing a shared header
parallel-j10.418s0.416s0.428sfirst Ninja build of 33 independent translation units with one job
parallel-j40.181s0.181s0.184sfirst Ninja build of 33 independent translation units with four jobs
coverage-report0.105s0.105s0.105sinstrumented run plus gcov summary generation
raw-cmake-cold0.228s0.227s0.229sraw CMake configure plus Ninja build without CLAP
clap-cmake-cold0.227s0.227s0.228sCLAP configure plus build of the same fresh CMake project
cmake-object-cache-cold1.075s1.070s1.087sfirst optimized CLAP CMake configure/build of a heavy project with object caching enabled
cmake-object-cache-hit0.252s0.251s0.267sclean optimized CLAP CMake configure/build of a heavy project after deleting the build directory with matching cached objects
object-cache-cold0.877s0.862s0.883sfirst opt-in object-cache build of an optimization-heavy project
object-cache-hit-small0.088s0.087s0.090sclean rebuild of a small two-source project with matching cached objects
object-cache-hit0.088s0.088s0.089sclean rebuild of the same heavy project with matching cached objects

How to read the comparisons:

  • raw-compiler-cold is only the compiler driver invocation. direct-cold additionally includes Python startup, project/config discovery, Ninja file generation, dependency-file setup, JSON result construction, and CLAP's incremental-build bookkeeping.
  • raw-cmake-cold and clap-cmake-cold both configure and build the same CMake project with Ninja. CLAP additionally performs compiler discovery/probing setup, exports compile commands, and emits structured metadata; small median differences at this scale should be treated as noise unless they persist across machines.
  • The object-cache comparison is the meaningful scaling signal: a heavy clean rebuild with matching cached objects is close to the small-project cache-hit cost instead of the heavy cold-compile cost. A cache hit still pays Python/Ninja startup, dependency validation, object restoration, and linking because the output binary is absent; therefore it should not be compared with a no-op rebuild.
  • For the heavy CMake project, deleting the build directory drops the measured median from the cold object-cache configure/build cost to roughly the configure-plus-cache-hit cost; CMake configure still dominates the small hit case, but the heavy compile work is avoided.
  • parallel-j1 versus parallel-j4 measures Ninja compile scheduling over 33 independent translation units. It is a scaling measurement, not a promised linear speedup; link time, Python startup, and machine load bound the result.

Scaling spot-check: 121 translation units ​

Recorded 2026-12-03 on the same machine with the pinned private Zig toolchain, generated project of 120 interdependent modules plus a main file:

MeasurementWall timeMeaning
cold parallel build0.505sfirst build of all 121 translation units
no-op rebuild0.096sunchanged rebuild check
single-source change0.144srebuild after touching one module; object cache restores unaffected objects

These are orchestration-cost measurements on small translation units — real-world compile time is dominated by source size, not file count. They show that Ninja parallelism plus the object cache keep the per-file fixed cost low enough that adding files is cheap.

Real-world compile times ​

Same machine, pinned toolchain, --profile release:

ProjectSizeCold build time
SQLite 3.50.4 amalgamation + shell~260k lines in 2 TUs17.7s
Lua 5.4.8 interpreter34 TUs4.1s

Both produce working binaries (verified by running SQL queries / Lua scripts); see REAL_WORLD_BUILDS.md.

Per-edge timing diagnostics ​

clap build --timing still reports the coarse toolchain/compile/run/total phases. For direct Ninja builds, JSON output additionally contains timing_steps: compile/link/archive edges whose Ninja log entries were refreshed by that invocation. Each step includes the raw Ninja output, resolved target, kind, start/end offsets in milliseconds, duration, and source when an object can be mapped back to an input source file. A no-op rebuild has an empty list; that is intentional and means Ninja found no work to do.

These edge timings are diagnostic data, not a CPU profiler. Parallel compile edges can overlap, very small edges are rounded to millisecond resolution by Ninja, and non-Ninja/CMake builds currently expose only the coarser phase timings.

Refresh this file with:

bash
python scripts/benchmark.py --format markdown --output docs/PERFORMANCE.md