Repository navigation
fix(javascript): yield inside semantic analysis and large projection passes - #1542
Merged
Merged
Conversation
…passes After #1525 the longest event-loop blocks were single stages on very large files: semantic analysis of Obsidian's 3.7 MB app.js ran 5.8 s in one piece, and its object projection 1.8 s. - analyzeParsedJavaScriptSemanticsSteps yields between the analysis phases and between the eight derived collectors; the synchronous function drains it, so results are unchanged. - Per-file analysis yields between open-receiver classification and static analysis and drives the semantic steps. - Semantic node creation, definitions and references, and the object and frontier passes yield every 64 items. Node creation keeps source order, which the per-file node budget depends on. On obsidian.asar the longest block falls from 5,355 ms to 907 ms with the same total time (40.6 s to 39.5 s). Graph IDs and complete result digests match main on five inputs. Remaining blocks up to about 0.9 s are single AST traversal passes inside the analyzers. Refs #1462 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…rapper Co-Authored-By: Claude Opus 5.5 <[email protected]>
N0zoM1z0
pushed a commit
that referenced
this pull request
Oct 10, 2026
After #1542 the longest event-loop blocks on large bundles were single AST traversals inside one analyzer: member-mutation collection with its fixpoint, static source analysis, and function fingerprints, each about one second on Obsidian's 3.7 MB app.js. - traverseJavaScriptAstSteps yields every 1,024 visited nodes with the same visit order; traverseJavaScriptAst drains it, so every existing caller is unchanged. - Member mutations, static analysis and fingerprints run as steps. The member-mutation fixpoint yields every 64 references, and fingerprints yield between callables. - The now-unused synchronous member-mutation and fingerprint wrappers are removed. Graph IDs and complete result digests match main on three inputs, including obsidian.asar. Over two runs there, the longest block falls from about 920 ms to 740 ms, the second from 860 to 595 ms, and blocks over 250 ms from 27 to 18, with total time within 1.5%. Refs #1462 Co-authored-by: Claude Opus 5.5 <[email protected]>
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
…passes (morluto#1542) * fix(javascript): yield inside semantic analysis and large projection passes After morluto#1525 the longest event-loop blocks were single stages on very large files: semantic analysis of Obsidian's 3.7 MB app.js ran 5.8 s in one piece, and its object projection 1.8 s. - analyzeParsedJavaScriptSemanticsSteps yields between the analysis phases and between the eight derived collectors; the synchronous function drains it, so results are unchanged. - Per-file analysis yields between open-receiver classification and static analysis and drives the semantic steps. - Semantic node creation, definitions and references, and the object and frontier passes yield every 64 items. Node creation keeps source order, which the per-file node budget depends on. On obsidian.asar the longest block falls from 5,355 ms to 907 ms with the same total time (40.6 s to 39.5 s). Graph IDs and complete result digests match main on five inputs. Remaining blocks up to about 0.9 s are single AST traversal passes inside the analyzers. Refs morluto#1462 * refactor(javascript): drop the unused synchronous derived-semantics wrapper ---------
darsrc
pushed a commit
to darsrc/rea
that referenced
this pull request
Oct 10, 2026
After morluto#1542 the longest event-loop blocks on large bundles were single AST traversals inside one analyzer: member-mutation collection with its fixpoint, static source analysis, and function fingerprints, each about one second on Obsidian's 3.7 MB app.js. - traverseJavaScriptAstSteps yields every 1,024 visited nodes with the same visit order; traverseJavaScriptAst drains it, so every existing caller is unchanged. - Member mutations, static analysis and fingerprints run as steps. The member-mutation fixpoint yields every 64 references, and fingerprints yield between callables. - The now-unused synchronous member-mutation and fingerprint wrappers are removed. Graph IDs and complete result digests match main on three inputs, including obsidian.asar. Over two runs there, the longest block falls from about 920 ms to 740 ms, the second from 860 to 595 ms, and blocks over 250 ms from 27 to 18, with total time within 1.5%. Refs morluto#1462
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.
Refs #1462. This follows #1525. That PR split the per-file work into stages and made graph construction and sealing stepwise. It noted single stages on very large files as the remaining blocks; this PR splits the largest of them.
Where the time was (Obsidian
app.js, 3.7 MB, currentmain)analyzeParsedJavaScriptSemantics), one stepprojectSemanticObjectsOpen-receiver classification and static analysis also ran in the same step (about 1.6 s).
Change
Domain:
analyzeParsedJavaScriptSemanticsStepsandcollectJavaScriptDerivedSemanticsStepsyield between phases and between collectors. The existing synchronous functions drain them, so every caller and result is unchanged. Each phase completes before the next starts.Per-file analysis yields between open-receiver classification and static analysis, and uses
yield*into the semantic steps.Projection:
projectDefinitionsAndReferences,projectSemanticObjectsandprojectSemanticFrontiersyield every 64 items;Node creation still runs in source order, which the per-file node budget (
SEMANTIC_GRAPH_FILE_NODE_CEILING) depends on.Everything is driven by the existing time-sliced
completeJavaScriptAnalysisSteps, with its 8 ms slices and abort checks.Results are identical
reconstructJavaScriptArtifacton currentmainand on this branch gives the same application graph ID, semantic graph ID and SHA-256 of the complete serialized result for:app.asarandobsidian.asar(23 MB, 36 JS files);app.asar;Measured effect
Full in-process analysis of
obsidian.asar, with a 1 ms event-loop gap monitor:b88d8f85, after #1525)app.js)mermaid.min.js)Remaining
The remaining blocks of up to about 0.9 s are single AST-traversal passes inside the analyzers: member mutations, fingerprints, static analysis, receiver classification. Going lower needs a stepwise
traverseJavaScriptAstthreaded through those collectors. That's a separate change, so #1462 stays referenced, not closed.Verification
src/domain/javascript/javascriptSemanticAnalysisSteps.test.ts: the stepwise analysis yields at least once per phase and collector, and returns exactly the synchronous IR.npx vitest run src/domain src/applicationpasses (170 files, 2,138 tests).npm run test:focusedpasses ontests/composition/javascript-applications,tests/acceptance/applications/{javascript,application}*,tests/boundary/mcp/{application,analysisView}*andtests/boundary/cli/analysisView*(20 files, 111 tests).npm run check:fastandnpm run docs:checkpass. The lint warnings in the touched files are the same set as onmain.🤖 Generated with Claude Code