on master help sign in
Skip unused capital-promotion scans

Avoid traversing the environment when no written capitals can be promoted. Preserve the existing path whenever capitals are present.

commit09db390f1a096f2e777ff7380899c4194b879b99 authoriko <mail@iko.soy> dateSat 31 Oct 2026, 12:56 (15 hours ago) parent4da6891
3 files changed+14−5
docs/compiler.md+3−1 docs/status.md+7−4 jibb-dev/lib/jibb.hoon+4
docs/compiler.md+3−1
@@ -62,7 +62,9 @@ A direct unshadowed prelude call can use checked source layouts when a positiona
6262
6363The checker retains a per-analysis index of finalized root gates and a prelude source table bound to the entire trusted prepared interface. A dependency screen avoids building the table when the root cannot use it; changing the interface invalidates it. The host remains responsible for supplying a prepared interface paired with its source. The matcher checks each slot and product in both directions with a shared substitution. Before returning its tentative proof it requires both complete call samples to normalize to closed, tag-free types, then repeats every slot check and requires the substitution and fresh-ID counter to remain unchanged. This keeps later argument or enclosing constraints from invalidating an earlier face check, and preserves pending constraints, capital checks and projection evidence. These scans and the bounded second proof add work; they do not establish a global linear-time bound.
6464
65−In single sequential eval runs including startup, 2,000 ordinary gates used 70.20 seconds of user CPU at baseline and 70.64 seconds with the cached source table. Fifty unsupported eligible scalar-slot calls used 24.75 and 25.71 seconds, while fifty function-slot failures used 24.15 and 25.36 seconds. Fifty successful calls took 26.56 seconds before the final stability replay and 26.99 seconds with it. These are synthetic measurements, not production performance limits.
65+Before the empty-capital optimization below, single sequential eval runs including startup showed that 2,000 ordinary gates used 70.20 seconds of user CPU at baseline and 70.64 seconds with the cached source table. Fifty unsupported eligible scalar-slot calls used 24.75 and 25.71 seconds, while fifty function-slot failures used 24.15 and 25.36 seconds. Fifty successful calls took 26.56 seconds before the final stability replay and 26.99 seconds with it. These are synthetic measurements, not production performance limits.
66+
67+Restricted-number promotion only applies to written capital variables. If none are present, it returns immediately instead of traversing the environment. In one startup-inclusive pair of runs on 2,000 independent gates, output was byte-identical and user CPU fell from 71.67 to 38.26 seconds; wall time was 72.80 versus 51.66 seconds while other checks were running. This does not establish a bound for dependent modules or a complete-checker benchmark.
6668
6769A single-arm cell pattern can bind two or more positions, with its last binder capturing the remaining tail. Duplicate and shadowed names are rejected. A definite non-cell spine fails; an intermediate union or collection that might contain a cell remains unsupported. For a known non-union cell, a separate one-arm rule also accepts structured patterns, including nested literal and wildcard positions, when the existing coverage proof establishes the whole pattern. It binds payloads with their original types and checks result context; unknown, partially covered, union or recursive spines stay unsupported.
6870
docs/status.md+7−4
@@ -51,6 +51,8 @@ An eval and ship fixture now reports partial inference for the unchanged todo is
5151
5252The prelude now writes `lth`, `gte` and `lte` in Jibb using `gth` and `not`. Supported generic and concrete calls infer, including loobeans; mismatched explicit auras fail. A source-aware Hoon import fixture records that nested mixed-zero overlaps are rejected conservatively and that some disjoint flag cases also remain unsupported. Execution, jet recognition and complete import checking remain unfinished.
5353
54+Restricted-number promotion now skips an environment scan when a definition has no written capitals. In a single startup-inclusive pair on 2,000 independent gates, output was identical and user CPU fell from 71.67 to 38.26 seconds; wall time was 72.80 versus 51.66 seconds with other checks running. This is a partial-inference measurement, not a complete checker or a bound on dependent modules.
55+
5456## Milestone 1: parser and mark
5557
5658What the plan asks for, and where it is:
@@ -68,7 +70,7 @@ What the plan asks for, and where it is:
6870Besides the plan's list:
6971
7072- 652 golden cases: 432 that parse and 220 that fail, each failure at a stated line and column. One failing case has an unclear expectation (corpus question 3). The newer type-output cases exercise only the partial inference fragment. Each case's `about.txt` quotes the doc's words it tests.
71−- The 652-case corpus passed under `urbit eval` in 122.4 s while other checks were running. The fake ship passed all 684 tests, including the importer, importer/checker and mark/checker bridges, module scope, unification, hole, qath, ask, default-wrapper importer, projection, arithmetic, generic-alias, positional-face, API-evidence, request, closed-gate, todo API, constructor, sub, nested-union, gate-free and direct-gate guards and the unchanged todo report, with 107.1 s for sync and 75.9 s for tests. The importer golden compares 221 projections; `tools/clay-fixtures` builds the example Hoon fixtures through Clay, checks a recursive Ford import's origin, and passes Clay-built types through the Clay-built importer and partial checker.
73+- The 652-case corpus passed under `urbit eval` in 111.5 s while other checks were running. The fake ship passed all 684 tests, including the importer, importer/checker and mark/checker bridges, module scope, unification, hole, qath, ask, default-wrapper importer, projection, arithmetic, generic-alias, positional-face, API-evidence, request, closed-gate, todo API, constructor, sub, nested-union, gate-free and direct-gate guards and the unchanged todo report, with 86.5 s for sync and 139.0 s for tests. The importer golden compares 221 projections; `tools/clay-fixtures` builds the example Hoon fixtures through Clay, checks a recursive Ford import's origin, and passes Clay-built types through the Clay-built importer and partial checker.
7274- `tools/testdata/selftest` (22 checks), `tools/testdata/ship-selftest` and `tools/testdata/clay-fixtures-selftest` test the tools themselves; the last checks temporary Clay fixture cleanup and signal handling without a ship.
7375- Two independent audits before 7c739b7, one of which compared the library with a reference parser written in Python from the doc over about 19,000 generated programs. Before ab797a9, a second Python parser, written from the decisions, agreed with the library on 8,000 generated programs and 900 hand-written probes.
7476- Speed: starting `urbit eval` and building the library takes about 8 s. After that, a 2,000-line module of 400 definitions parses in about a second. Loops over definitions, arms, lines and items grow no stack; nesting costs a few stack frames a level, and 100,000 nested brackets still parse (library section 3).
@@ -167,14 +169,15 @@ Besides the plan's list:
167169| 706035c | 2026-10-31 | Analyze gate-free source molds with field witnesses |
168170| 651b8ec | 2026-10-31 | Match source-proven gate samples in direct calls |
169171| cc8e389 | 2026-10-31 | Add source-backed list length and real todo regression |
170−| This change | 2026-10-31 | Add source-backed comparisons and nested Hoon union controls |
172+| 4da6891 | 2026-10-31 | Add source-backed comparisons and nested Hoon union controls |
173+| This change | 2026-10-31 | Skip unnecessary inference environment scans |
171174
172175## Checking it
173176
174177On a machine set up as [development.md](development.md) says:
175178
176179```
177−tools/golden # 649 cases under urbit eval
180+tools/golden # 652 cases under urbit eval
178181tools/importer-test # the Hoon importer fixture projection
179182tools/type-import-default-test # default-wrapped source proof golden
180183tools/type-import-test # the importer/checker bridge fixture
@@ -196,7 +199,7 @@ tools/testdata/selftest # the tools themselves
196199tools/doc-blocks docs/spec # the doc's examples are golden cases
197200tools/ship start
198201tools/ship gen-tests --check # tests/lib/jibb.hoon is up to date
199−tools/ship test # the same 649 cases as -test arms on the ship
202+tools/ship test # the same 652 cases as -test arms on the ship
200203tools/testdata/ship-selftest
201204tools/testdata/clay-fixtures-selftest # scratch fixture cleanup without a ship
202205tools/ship check-commit # |commit stores .jibb files
jibb-dev/lib/jibb.hoon+4
@@ -4607,6 +4607,8 @@
46074607:: Atom constraints tied to an explicit capital or an inferred sample
46084608:: are generalized and printed. Other aura variables remain unsupported until
46094609:: their defaulting and inferred generalization are implemented.
4610+:: Restricted-number promotion considers written capitals only; if there
4611+:: are none, it skips the otherwise unnecessary environment traversal.
46104612:: Bare @ is a separate unrestricted atom type. A directional fit check
46114613:: permits concrete atoms to widen to it, never the reverse. A fit that
46124614:: needs a not-yet-implemented constraint remains unsupported. Named unions
@@ -5794,6 +5796,8 @@
57945796++ promote-restricted-numbers
57955797 |= [state=istate env=ienv]
57965798 ^- istate
5799+ :: With no written capitals, there is nothing to promote.
5800+ ?~ caps.state state
57975801 =/ ids=(list @ud) (turn caps.state |=(c=icap id.c))
57985802 =/ free=(list @ud) (free-env-vars env sub.state)
57995803 |-