Repository navigation
Keep where each environment's process is: no freeze on a chain of functions called in $( ) (refactor 3.2) - #246
Merged
Conversation
sf624
added this pull request to stack #243
October 23, 2026 11:40
Contributor
|
Web preview: https://sf624.github.io/bash-explainer/pr/246/ (commit c24a9e3) |
sf624
force-pushed
the
refactor/3.2-processof
branch
from
October 23, 2026 12:31
d18032b to
06d13a4
Compare
sf624
force-pushed
the
refactor/3.2-processof
branch
2 times, most recently
from
October 23, 2026 13:51
2937112 to
75fa871
Compare
… 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
force-pushed
the
refactor/3.2-processof
branch
from
October 23, 2026 14:20
75fa871 to
c24a9e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor step 3.2, a fourth layer of the stack (#240, #241, #242): two findings of the reviews of 3.2.
processOfis 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 innpx tsx test/dump.ts(16 s withif 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