20add51112
Tidy iter addressing the audit-mut-local drift. Plus paired baseline
update on bench/baseline_compile.json (audit-skill discipline).
Architect [high] items closed:
1. CheckError::MutVarCapturedByLambda rejects lambdas whose body
free vars include a mut-var of the enclosing mut_scope_stack.
Uses the existing ailang_core::desugar::free_vars_in_term walker
(which honours Term::Match pattern bindings). The scan runs only
when mut_scope_stack is non-empty.
2. crates/ailang-codegen/src/lambda.rs: the capture-not-in-locals
path that previously raised CodegenError::Internal blaming the
typechecker now uses unreachable!. The companion comment block
was rewritten to state the current reality.
Architect [medium] items closed (stale mut.1-stub history comments):
3. docs/DESIGN.md §'Term (expression)' mut/assign block: the
trailing paragraph describing the iter mut.1 stub state was
replaced with one describing the current mut.3-end-state. The
inline jsonc comment on {'t': 'assign'} was updated to drop the
'deferred to mut.2/mut.3' language.
4. crates/ailang-codegen/src/lib.rs: the stale comment block above
the real Term::Mut arm describing the mut.1 stub was removed
entirely.
Other:
- Short-circuit on empty mut_scope_stack in synth's Term::Var arm:
the iter mut.2 prepend now skips the iter-and-find walk when
the stack is empty, eliminating any per-Var-resolution overhead
for the common case (programs with no mut blocks). The
short-circuit did NOT close the check_ms regression — see ratify
below.
- Spec docs/specs/2026-05-15-mut-local.md §'Out of scope' amended
with the lambda-capture rejection bullet.
- Negative fixture examples/test_mut_var_captured_by_lambda.ail.json
+ driver test extension in crates/ailang-check/tests/
mut_typecheck_pin.rs (6th test) +
crates/ailang-core/tests/carve_out_inventory.rs EXPECTED bumped
12 → 13.
Bench-regression ratify:
bench/compile_check.py check_ms showed a uniform ~30-50% relative
shift across the entire 11-fixture suite (~0.5ms absolute on a
1.4-1.5ms baseline). The uniformity across fixtures of very
different Var counts argues for a fixed-cost-per-invocation tax,
not a Var-proportional hot path. The Term::Var short-circuit
falsified the hot-path hypothesis. The plausible remaining causes
(synth-parameter-passing through ~19 recursive sites, and binary-
size startup tax from mut-* adding ~1400 LOC to typecheck/codegen)
are both feature-cost, not pathological. Ratified by paired
journal entry; bench/baseline_compile.json updated to the post-
mut-local numbers via 'bench/compile_check.py --update-baseline'.
bench/check.py continues to show the established tail-latency-noise
envelope from audit-pd (2026-05-14) — no separate ratify needed.
bench/cross_lang.py clean.
Tests: 594 → 598 green (4 new lib.rs mod tests + 1 driver test +
1 fixture-corpus uptake).
Journal: docs/journals/2026-05-15-iter-mut.4-tidy.md.
mut-local milestone end-to-end status:
- mut.1 (7b92719): AST + Form A surface.
- mut.2 (b24718a): typecheck.
- mut.3 (03fb633): codegen + e2e.
- mut.4-tidy (this commit): audit-drift close + bench ratify.
mut-local milestone CLOSED.
Refs: docs/specs/2026-05-15-mut-local.md,
docs/plans/2026-05-15-iter-mut.4-tidy.md.
107 lines
2.4 KiB
JSON
107 lines
2.4 KiB
JSON
{
|
|
"version": 1,
|
|
"captured": "2026-05-15",
|
|
"captured_via": "bench/compile_check.py",
|
|
"note": "Compile-time bench. `check_ms` is `ail check FILE`; `build_O0_ms` is `ail build --opt=-O0 FILE`. Wall-clock includes subprocess spawn (~5-10 ms on Linux) and, for build, the clang link step. Tolerances are tuned for noise on a quiet developer machine, not as the language correctness bar.",
|
|
"check_ms": {
|
|
"hello": {
|
|
"baseline_ms": 1.78,
|
|
"tolerance_pct": 25
|
|
},
|
|
"list_map_poly": {
|
|
"baseline_ms": 1.96,
|
|
"tolerance_pct": 25
|
|
},
|
|
"local_rec_capture": {
|
|
"baseline_ms": 1.87,
|
|
"tolerance_pct": 25
|
|
},
|
|
"borrow_own_demo": {
|
|
"baseline_ms": 1.87,
|
|
"tolerance_pct": 25
|
|
},
|
|
"nested_pat": {
|
|
"baseline_ms": 3.32,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_list_sum": {
|
|
"baseline_ms": 1.99,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_tree_walk": {
|
|
"baseline_ms": 1.93,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_closure_chain": {
|
|
"baseline_ms": 1.96,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_hof_pipeline": {
|
|
"baseline_ms": 2.01,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_compute_intsum": {
|
|
"baseline_ms": 1.84,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_compute_collatz": {
|
|
"baseline_ms": 1.94,
|
|
"tolerance_pct": 25
|
|
},
|
|
"bench_list_sum_explicit": {
|
|
"baseline_ms": 2.04,
|
|
"tolerance_pct": 25
|
|
}
|
|
},
|
|
"build_O0_ms": {
|
|
"hello": {
|
|
"baseline_ms": 90.78,
|
|
"tolerance_pct": 20
|
|
},
|
|
"list_map_poly": {
|
|
"baseline_ms": 93.63,
|
|
"tolerance_pct": 20
|
|
},
|
|
"local_rec_capture": {
|
|
"baseline_ms": 93.13,
|
|
"tolerance_pct": 20
|
|
},
|
|
"borrow_own_demo": {
|
|
"baseline_ms": 92.56,
|
|
"tolerance_pct": 20
|
|
},
|
|
"nested_pat": {
|
|
"baseline_ms": 97.36,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_list_sum": {
|
|
"baseline_ms": 93.93,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_tree_walk": {
|
|
"baseline_ms": 94.0,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_closure_chain": {
|
|
"baseline_ms": 93.06,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_hof_pipeline": {
|
|
"baseline_ms": 94.59,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_compute_intsum": {
|
|
"baseline_ms": 91.65,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_compute_collatz": {
|
|
"baseline_ms": 93.36,
|
|
"tolerance_pct": 20
|
|
},
|
|
"bench_list_sum_explicit": {
|
|
"baseline_ms": 94.03,
|
|
"tolerance_pct": 20
|
|
}
|
|
}
|
|
}
|