-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust/Swift: Cache Element.toString
#18968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
@@ -4,7 +4,7 @@ | |||
|
|||
module Impl { | |||
class Decl extends Generated::Decl { | |||
override string toString() { result = super.toString() } | |||
override string toStringImpl() { result = super.toStringImpl() } |
Check warning
Code scanning / CodeQL
Redundant override Warning
Redundant override of .
this predicate
Error loading related location
Loading 5ab442f
to
03a87de
Compare
Element.toString
Element.toString
redsun82
previously approved these changes
Mar 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice, thanks!
03a87de
to
dcd01be
Compare
Rebased to resolve merge conflict. |
redsun82
approved these changes
Mar 17, 2025
Swift integration tests failure is a timeout flake, merging this now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
no-change-note-required
This PR does not need a change note
Rust
Pull requests that update Rust code
Swift
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.
Sadly, we cannot put the
cached
annotation directly on the existingtoString
predicate, as that introduces spurious non-monotonicity errors (the non-monotonicity checker considerscached
predicates to be black-boxes). Instead, we add an intermediatetoStringImpl
predicate, which acts like the previoustoString
predicate, and then cache the newtoString
predicate, which simply forwards totoStringImpl
.DCA shows a nice average 7% analysis time speedup.