Skip to content

Build: compile/serialize the build graph once per invocation; stop re-interpreting build.w per worker (study delta 9) #683

Closed

Description

@ehartford

Part of #679. build(ctx) and every action run under the comptime interpreter, and each stale action/test target spawns a worker that re-compiles build.w + prelude and re-runs build(ctx) before evaluating its single action (src/main.w:1322-1356, rationale at :1424-1428), each eval deep-cloning Sema type tables (src/Sema.w:1294-1320). Measured: ~1.1s minimum per trivial action (build-times.tsv two-action probe). Zig compiles build.zig ONCE into a content-cached native build_runner (src/main.zig:4952, :5293-5326). Adopt: serialize the evaluated graph once per build (the action signature already hashes build.w source, so the invalidation key exists) and have workers load it. Expected: low single-digit minutes per battery + hundreds of MB of driver RSS; grows with the target graph that #680 will widen.

Activity

  1. added 4 commits that reference this issue on Jul 18, 2026
  2. ehartford commented on Jul 19, 2026

    @ehartford
    ContributorAuthor

    LANDED (c81e817, battery-green GATES EXIT: 0, fixpoint byte-identical, reseeded gc81e81739 + asset refreshed): serial build.w actions run in-process in the driver.

    The measured floor was each serial action spawning with build :name --no-deps — a child that recompiled build.w + std.build through the full frontend (~0.85 s) and re-materialized the graph, only to reach the exact comptime_eval_tool_action_result call the parent could make directly with its already-evaluated Sema. The parent now falls through to the in-process eval and records the cache verdict itself (the always-false cache_recorded plumbing is deleted, −22 lines net).

    Measured (18-core host):

    • Per serial action: compiler-main-source 1.6 → 0.0 s (byte-identical output), prepare-bootstrap-link-root 1.6 → 0.0 s, bootstrap-llvm-link-metadata 2.0 → 0.8 s.
    • Commit-shape rebuild (WITH_VERSION probe): 13.9 → 10.4 s (−25 %).
    • Full cold build driven by the new executor passed end-to-end in a clean worktree (46 targets).

    What remains of the original scope, and why I'm closing anyway: pooled compile children still re-eval build.w per action, but their ~0.85 s each is hidden behind cores/2-wide parallelism (~3 s residual wall per cold build) — a worker-slice protocol isn't worth that residue. Test-target workers pay one re-eval per target (5/battery — noise). Full graph serialization is subsumed by #682's snapshot machinery if it ever becomes worth it: the graph metadata is trivial, and the action BODIES are comptime closures that need a compiled build.w Sema either way — which is exactly what #682 serializes. Reopen if pool-width-limited hosts measure differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions