Issue #634: May the compiler run a call with constant arguments at build time as an optimisation, where no comptime asks for it?

Open and answer this issue on GitHub.

decision · opened 2026-10-17 · updated 2026-10-17 · 0 comments

Where this comes from

The owner split this off from #633 (October 17, 2026). #633 decides that a call with constant arguments is compiled and run at build time where a claim needs its value (ADR-359 D11-D13, the ADR-321 path). What is left open is the other use: running such a call at build time only to save work at run time, where neither a comptime nor a claim asks for it.

The question

let table = build_table(256) is a sync call that touches nothing and has constant arguments. The program does not write comptime. May the compiler, on its own, run it while building and put the value into the program, the way ADR-321 runs a comptime?

What is known

Still owed before a decision round

  1. Options: never (the program writes comptime when it wants the shift); a hint (comptime would move this to the build); automatic within a budget; automatic only in a release build.
  2. For each option: who pays, the effect on build time and on the cache, what happens when the budget runs out (silently left to run time?), and how the user sees it.
  3. How others do it: C++ (constexpr is evaluated only where required; optimisers fold), Zig (comptime only where written), Rust (const only; LLVM folds), GraalVM/partial evaluation.
  4. A count: how many calls in the corpus would qualify, and what they cost at run time (callgrind, counted).
  5. A recommendation (CLAUDE.md, Decision rounds with the owner).

Back to Open Issues