Conversation
PR SummaryLow Risk Overview Adds Reviewed by Cursor Bugbot for commit e12b013. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58ceea9ac9
ℹ️ 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".
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on eytan-starkware and orizi).
0393408 to
33e4ae0
Compare
3251d29 to
d98cfb7
Compare
33e4ae0 to
a53f993
Compare
a53f993 to
e6e2d25
Compare
d98cfb7 to
6296ede
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on eytan-starkware and TomerStarkware).
e6e2d25 to
e12b013
Compare
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on orizi).

Summary
Moves the
is_empty()short-circuit check fromConstantEvaluateContext::substituteintoGenericSubstitution::substitute, so that all callers ofGenericSubstitution::substitutebenefit from the optimization rather than only the constant evaluation path.Type of change
Please check one:
Why is this change needed?
The early-exit guard that avoids constructing a
SubstitutionRewriterwhen the substitution map is empty was only present inConstantEvaluateContext::substitute. Any other caller ofGenericSubstitution::substitutewould unconditionally allocate and run the rewriter even when there is nothing to substitute.What was the behavior or documentation before?
GenericSubstitution::substitutealways constructed aSubstitutionRewriterand ran a full rewrite, regardless of whether the substitution was empty.ConstantEvaluateContextworked around this with a localis_empty()check before calling through.What is the behavior or documentation after?
GenericSubstitution::substituteitself checksis_empty()and returns the object unchanged without constructing aSubstitutionRewriter. The redundant local check inConstantEvaluateContext::substituteis removed.Related issue or discussion (if any)
Additional context
This is a purely mechanical refactor with no behavioral change; the optimization is identical, just applied at the right abstraction level.