Conversation
This was referenced Jan 11, 2026
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
TomerStarkware
approved these changes
Jan 12, 2026
Collaborator
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware reviewed 6 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware).
51f6ea1 to
e397122
Compare
5ee68e9 to
0277b49
Compare
This was referenced Jan 13, 2026
Closed
orizi
commented
Jan 13, 2026
Collaborator
Author
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @ilyalesokhin-starkware).
Minor performance gain. Prevents recursive reconstruction. SIERRA_UPDATE_MINOR_CHANGE_TAG=No interface change.
e397122 to
86e315e
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.

Summary
Refactored the
ApplyApChangetrait to modify values in-place rather than returning new values. This changes the signature fromfn apply_known_ap_change(self, ap_change: usize) -> Option<Self>tofn apply_known_ap_change(&mut self, ap_change: usize) -> bool, which simplifies error handling and avoids unnecessary cloning. The implementation also improves the handling of AP change overflow by usingnum_traits::ToPrimitivefor safer conversions.Type of change
Please check one:
Why is this change needed?
The previous implementation of
ApplyApChangerequired cloning and recreating objects when applying AP changes. By modifying values in-place, we can avoid unnecessary allocations and improve performance, especially in code paths that apply AP changes frequently.What was the behavior or documentation before?
Previously,
apply_known_ap_changeconsumedselfand returned a new instance wrapped in anOption, requiring callers to handle theNonecase separately and often leading to unnecessary cloning of data structures.What is the behavior or documentation after?
Now
apply_known_ap_changetakes&mut selfand returns a boolean indicating success, which is more efficient and follows a more conventional error-handling pattern. The implementation also usesnum_traits::ToPrimitivefor safer numeric conversions.Additional context
This change affects multiple implementations of the
ApplyApChangetrait across the codebase, includingResOperand,CellRef,DerefOrImmediate,BinOpOperand,CellExpression, andReferenceExpression. Tests have been updated to use a helper function that maintains the previous API for testing purposes.