Performance optimizations - #258
Open
lm-sousa wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e09012a63f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
lm-sousa
force-pushed
the
clava-optimizations
branch
from
September 4, 2026 23:53
e09012a to
e08d307
Compare
lm-sousa
force-pushed
the
clava-optimizations
branch
2 times, most recently
from
September 5, 2026 00:15
6b98c31 to
518bfff
Compare
renameLabels() searched the whole AST for every inline even though the $newNodes parameter it received (unused since fa56385) already contains the complete copied body. Scope both searches with Query.searchFrom($newNodes, ...), which also stops renaming labels of unrelated functions and removes a latent replaceWith(undefined) on labels with no map entry. Regenerate InlinerTest goldens: label numbering is now per-inline sequential (inliner_0_, inliner_1_) instead of driven by the global whole-AST counter.
lm-sousa
force-pushed
the
clava-optimizations
branch
from
September 6, 2026 03:18
518bfff to
70c30bd
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.



Stacked on #257 (only shows this commit until that merges).
Inliner.renameLabels()ran two whole-ASTQuery.search()passes for every inlined call — walking the entire program to rename labels that all live inside the copied body, even though the method already receives the complete $newNodes copy. The parameter has been unused since the feature's introduction (referenced only in a commented-outprintln), and the earlier triage attributed ~9 s of Query time to it.This scopes both searches with
Query.searchFrom($newNodes, …)— the same proven pattern the method already uses for forward declarations. Renaming runs on the detached body copy before insertion, where cross-function gotos cannot exist, so every goto/label pair stays consistently matched. As a side effect it stops renaming labels inside functions that were never inlined and eliminates a latentreplaceWith(undefined)on labels with no map entry; labels that clang's return-lowering attaches to the caller's own body now keep their original name, and each inlined copy carries its own renamed set, so no duplicate-label collision is possible.The InlinerTest goldens were regenerated: label numbering is now per-inline sequential (
inliner_0_,inliner_1_) instead of driven by the whole-AST counter; the diff touches label lines only.Part of the step-2 change set measured with the syntax-rebuild revisions: suite median 111.79 s → 47.60 s (the SpecsSystem half of that step is in specs-java-libs#32).