Skip to content

tools: compile_bench, a compile-to-result timer - #1159

Merged
godofecht merged 1 commit into
mainfrom
devin/compile-bench
Oct 1, 2026
Merged

godofecht merged 1 commit into
mainfrom
devin/compile-bench

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

A flow tool that measures the externally visible stages of a compile as processes and reports minimum-of-N timings as JSON (#735):

./flow tool compile_bench
{"program": "examples/basics/hello_world.flow", "loc": 6, "emit_ms": 4, "cc_ms": 47, "run_ms": 101, "total_ms": 152, "reps": 3, "loc_per_emit_s": 1500}
{"program": "examples/basics/fibonacci.flow", "loc": 12, "emit_ms": 5, "cc_ms": 49, "run_ms": 100, ...}
{"program": "compiler/src/main.flow", "loc": 2488, "emit_ms": 5137, "cc_ms": 13440, "run_ms": 155, ...}
  • Stages: emit_ms (Stage-A flowc via the bootstrap binary), cc_ms (C toolchain), run_ms (compiled program launch, lenient: a nonzero exit still counts), total_ms compile-to-result.
  • Stock programs are tiny, small and large; --repeat N and extra program paths are accepted.
  • The compiler under test is compiler/bootstrap/flowc_stage_a.c compiled to build/compile_bench/flowc_bootstrap, rebuilt when missing or older than the C.
  • Written in Flow over std.process; no new scripts.

This covers the compile-to-result dimension of #727 and is the harness the in-compiler phase timers (#735 remainder) will feed. The parse / resolve / typecheck / mono split still needs instrumentation inside compiler/src, left out deliberately because those files have other work in flight.

Test plan

  • ./flow tool compile_bench --repeat 3 produces three JSON lines, exit 0
  • custom program paths and --repeat handled; missing files report and exit 1

Measures the three externally visible stages of a Flow compile -- flowc emit, cc -O2, program run -- as minimum-of-N JSON lines with source LOC per emit second. Stock programs cover tiny (hello_world), small (fibonacci) and large (compiler/src/main.flow bundle).

The in-compiler phase split (parse, resolve, typecheck, mono, emit) still needs instrumentation inside compiler/src; this gives the #727 tracked dimension and a harness to feed it.
@godofecht
godofecht force-pushed the devin/compile-bench branch from 0ee53d4 to 7c23365 Compare October 1, 2026 21:36
@godofecht
godofecht merged commit ca3d821 into main Oct 1, 2026
28 checks passed
@godofecht
godofecht deleted the devin/compile-bench branch October 12, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant