Repository navigation
Description
For an arrayed target with per-element equations, a link score has one slot per target element, and there is one link score per source element.
With N elements that is about N^2 slots for one causal edge, almost all of them for target elements that do not read that source element.
Generation time grows 4x per doubling of N.
Example
growth[Wide] with per-element equations pop[e] * rate * 0.01, pop[Wide] a stock fed by growth, rate a scalar:
| N | LTM generation | link scores | slots |
|---|---|---|---|
| 100 | 141 ms | 101 | 10,101 |
| 400 | 2,304 ms | 401 | 160,401 |
On C-LEARN, 9,514 of 12,364 generated slots did not read their source.
What has been done
A slot is skipped (lowered to one store of 0) when its equation is provably the target's previous value: everything outside a PREVIOUS is a literal or operator.
Testing only "the source is held fixed" is not enough; it rewrote real C-LEARN scores to 0 when tried, because other inputs can still vary.
On C-LEARN this skipped 4,335 slots (17% of the flow program) with bit-identical results.
Another 5,023 were blocked only by a varying TIME; link-score equations now hold the clock fixed (#1016) and the check treats that as a one-step lag, so most of them should now be skipped too.
Not re-measured.
Fix
- Re-measure on C-LEARN and with
per_element_generation_scaling, and record what is left. - The remaining cost is not the slots: at N=400 with skipping, 439 ms of 520 ms is re-parsing and lowering the whole N-element target twice per link.
Removing that is the fragments plan (docs/design-plans/2026-09-04-link-scores-from-fragments.md, not started); do not patch it separately.
Keep skipping only where the target has no EXCEPT default (there an absent slot takes the default, not 0).
#1060 and #1022 bear on which slots count as zero.
Pointers
src/simlin-engine/src/ltm_augment.rs:build_arrayed_link_score_equationsrc/simlin-engine/src/ltm_augment_zero_slot.rs: the skip checksrc/simlin-engine/src/db/ltm_tests.rs:per_element_generation_scaling(ignored; the timing instrument)src/simlin-engine/src/db/ltm_value_gate_tests.rs: value checks for the skip
Activity
engine: delete the LTM occurrence fields nothing reads
[-]ltm: link-score generation is quadratic in an arrayed target's element count ((N+1)^2 equation arms per edge)[/-][+]ltm: link-score generation materializes one full guard-form arm per element of an arrayed target (quadratic in element count)[/+]engine: disclose and pin the LTM omission's non-finite value change
engine: performance pass on compile, simulation, and the LTM path (#1021
engine: test C-LEARN's leading loops, not a digest
[-]ltm: link-score generation materializes one full guard-form arm per element of an arrayed target (quadratic in element count)[/-][+]ltm: link-score generation is quadratic in an arrayed target's size[/+]