Skip to content

Compare compiled startup with Python invocations - #1268

Merged
godofecht merged 14 commits into
mainfrom
devin/cold-start-compare
Oct 6, 2026
Merged

godofecht merged 14 commits into
mainfrom
devin/cold-start-compare

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • Add --python-code CODE to compile_bench.
  • Time the matching python3 -c CODE invocation with the same repetition count.
  • Emit python_ms and run_vs_python_x100 beside the existing run_ms field.

Test plan

  • ./flow tool compile_bench --repeat 3 --python-code 'print("Hello, world!")' examples/basics/hello_world.flow
  • ./flow tool compile_bench --python-code exits 2 with a clear argument error

Local result

{"program": "examples/basics/hello_world.flow", "loc": 6, "emit_ms": 6, "cc_ms": 55, "run_ms": 104, "total_ms": 165, "python_ms": 11, "run_vs_python_x100": 945, "reps": 3, "loc_per_emit_s": 1000}

Refs #746

compile_bench can now time a matching python3 -c invocation beside the
compiled program run stage. With --python-code, each JSON row records the
Python minimum and a Flow/Python startup ratio.

Refs #746
cursoragent and others added 2 commits October 5, 2026 11:43
Keep --python-code on compile_bench alongside --host/--compiler and
the compile-to-result profile fields that landed on main.

Co-authored-by: Abhishek Shivakumar <[email protected]>
Probe-link without optional Python/GPU/OpenSSL load commands when the
program reaches none of their symbols, so hello-world binaries no longer
pay for those dylibs at exec time. FLOW_NO_LINK_TRIM=1 and sanitizer
builds keep the full link.

compile_bench --python-code records python_ms / run_vs_python_x100 next
to run_ms and bin_bytes. Tests cover the argument error, the lean link,
and generated C with no constructors.

Part of #746

Co-authored-by: Abhishek Shivakumar <[email protected]>
Init the #740 profiler lazily on the first routed allocation so a
program that never allocates pays no constructor before main.

Part of #746

Co-authored-by: Abhishek Shivakumar <[email protected]>
cursoragent and others added 9 commits October 5, 2026 11:54
compiler/bootstrap: took main's, then bootstrap_from_c.sh --regen (fixed point at gen2 on
macOS and Linux x86-64); checked-in flowc_stage_a rebuilt for Linux x86-64 like main's.
docs/project/CHANGELOG.md: kept main's entries and this branch's.
Only docs/project/CHANGELOG.md conflicted (after #1357); kept both.
Bring #1350 compile-profile changes onto the cold-start compare branch,
restore --python-code / python_ms emission lost in the merge, and regen
bootstrap (Linux x86-64 ELF) to the fixed point.
Tree already contained the #1350 compile-profile work from the prior
content merge; this commit records the real merge so the branch is up
to date with main. Keep --python-code/python_ms and the regenerated
Linux bootstrap.
Resolve CHANGELOG both-sides. Regenerate bootstrap C and Linux
flowc_stage_a ELF to match post-#1351 main.
@godofecht
godofecht merged commit 4bf1431 into main Oct 6, 2026
42 checks passed
@godofecht
godofecht deleted the devin/cold-start-compare 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.

2 participants