You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ltm: element-level loop finding spends most of its time on strings #955
On arrayed models where element-level loop finding enumerates many loops, most of the time goes to per-loop string work (building subscripted names, rotating each loop to a canonical start, building sort keys), not to the graph search itself.
Example
square_owner_whole_rhs_declines_and_skips_loudly in tests/integration/ltm_array_agg.rs (a 4-variable model, 8 elements) takes about 2.9 s in a debug build, against about 0.3 s for similar tests.
A perf profile spreads the time over build_element_subscripted_links, lex_smallest_rotation_start, loop_id_sort_key, johnson_circuit, strip_subscript, and identifier canonicalization and allocation.
Why it matters
Seen only in that fixture. #1017 has the minimal reproduction and the diagnosis: those loops are all discarded afterwards because they pass through a link LTM cannot score.
Fix
Do canonical rotation and id sorting on integer node ids, and build strings only for loops that survive.
Track this together with #1017; skipping the discarded loops there may remove the case that motivated this.
changed the title [-]engine: LTM element-level circuit enumeration spends most of its time in string canonicalization/rotation churn (cross-product shapes)[/-][+]ltm: element-level loop finding spends most of its time on strings[/+]on Oct 12, 2026
Activity
engine: cut test-suite wall clock (split serial mega-tests)
engine: compiler optimization pass (C-LEARN -33%, LTM on world3 9.8x,…
[-]engine: LTM element-level circuit enumeration spends most of its time in string canonicalization/rotation churn (cross-product shapes)[/-][+]ltm: element-level loop finding spends most of its time on strings[/+]bpowers commentedon Oct 12, 2026
Closing as a duplicate of #1017.
Same test and same slow path as #1017, which has the minimal repro and diagnosis; integer-id rotation is folded into #1017 as the alternative fix.