Skip to content

Keep where each environment's process is: no freeze on a chain of functions called in $( ) (refactor 3.2) - #246

Merged
sf624 merged 3 commits into
refactor/3.2-conditionsfrom
refactor/3.2-processof
Oct 23, 2026
Merged

sf624 merged 3 commits into
refactor/3.2-conditionsfrom
refactor/3.2-processof

Conversation

@sf624

@sf624 sf624 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Refactor step 3.2, a fourth layer of the stack (#240, #241, #242): two findings of the reviews of 3.2.

processOf is kept per environment and per call link (src/semantics/env.ts). It read the chains of every call of a function again for each of its callers' calls. In a chain of functions where each one runs the one before in $( ) and calls the one before that plainly (f3() { local a=$(f2); f1; }), that doubled at each function: 40 of them took 52–54 s in npx tsx test/dump.ts (16 s with if x=$(…)). Now 0.7–0.9 s for every shape tried (plain, set -e, if, ||, &&, |, ( ) &). Environments and call links never change once made, so the results are the same: every probe test passes, and the dumps of the fixtures and of 21 chain scripts (12, 20, 25 functions, each shape; 40 for three of them) are identical before and after.
Test: test/env.test.ts "explains a long chain of functions, each called in $( ) and plainly, in little time" (each shape, 40 functions, every line, under 5 s; it took 85 s before).

The timing test of the arithmetic bound is measured against a baseline of the same run (test/state.test.ts "gives up on an expression too long or too deep to follow, quickly"). It failed on loaded machines (3.5 s against 3 s; 1.3 s alone). Now 600 lines past the bound must take less than three times as long as 60 lines (followed, they would take ten times as long). A failing test also skipped the cleaning of the coverage report, which is why src/wordfacts.ts:40 looked uncovered then; it is covered when the tests pass.

The same for test/state.test.ts "is fast on long scripts with many functions" (300 functions against 150) and test/nested.test.ts "takes a time linear in the strings…" (2,000 lines against 200), which also failed under load.

CHANGELOG: one Fixed line (the freeze on such scripts).

🤖 Generated with Claude Code

@sf624
sf624 added this pull request to stack #243 October 23, 2026 11:40
@sf624 sf624 changed the title refactor/3.2 processof Keep where each environment's process is: no freeze on a chain of functions called in $( ) (refactor 3.2) Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

@sf624
sf624 force-pushed the refactor/3.2-processof branch from d18032b to 06d13a4 Compare October 23, 2026 12:31
@sf624
sf624 force-pushed the refactor/3.2-processof branch 2 times, most recently from 2937112 to 75fa871 Compare October 23, 2026 13:51
sf624 and others added 3 commits October 23, 2026 22:53
… in $( ) and plainly no longer takes minutes

processOf read the chains of every call of a function again for each of its callers' calls, which doubled at each
function of such a chain: 40 of them took about a minute in the analyzer. It is now kept per environment and per call
link (both never change once made); the results are the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he same run, not a fixed time

The test failed on a loaded machine (3.5 s against 3 s, 1.3 s alone); a failing test also skips the coverage
report's cleaning, which made src/wordfacts.ts look uncovered. Ten times the lines past the bound now take less than
three times as long as the lines up to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f the same run, not a fixed time

Both failed on a loaded machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sf624
sf624 force-pushed the refactor/3.2-processof branch from 75fa871 to c24a9e3 Compare October 23, 2026 14:20
@sf624
sf624 merged commit 12bd92c into main Oct 23, 2026
16 checks passed
@sf624
sf624 deleted the refactor/3.2-processof branch October 23, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant