-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ConstraintGraph] Fix contractEdges
to gather constraints only once
#16560
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
Conversation
@swift-ci please test |
@swift-ci please smoke test compiler performance |
@swift-ci please test source compatibility |
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.
LGTM!
How much does this speed up type checking cases like SR-7632?
Currently we have this non-optimal behavior in `contractEdges` where for every type variable it gathers constraints for its whole equivalence class before checking if any are "contractable", instead constraints could be gathered/filtered once which removes a lot of useless work.
Can we add a scale_test for this? |
@slavapestov I will try, but the problem is that we don't really have a good counter right now to measure the effect at the moment... |
FYI I've tried with 25k element array of ints e.g. |
@xedin You should just add a new counter that would be quadratic without this change. I think it’s important to test this so we don’t regress in the future. |
@slavapestov Yeah, I'm trying to figure out what might it be, maybe it should be "num constraints considered by each contraction run", that metric would grown much slower comparing to before, it would be |
@graydon Could you please take a look at statistics changes? I wonder why I get |
I wonder if that’s because that particular test would actually never find any contractable constraints... I will try putting it in find since that actual iteration. |
@swift-ci please source compatibility |
…edge contraction attempt
@swift-ci please source compatibility |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please smoke test macOS platform |
@swift-ci please test macOS platform |
Currently we have this non-optimal behavior in
contractEdges
wherefor every type variable it gathers constraints for its whole equivalence
class before checking if any are "contractable", instead constraints
could be gathered/filtered once which removes a lot of useless work.