-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Retry constraint.replace
after constraint.updateEntry
#20399
Retry constraint.replace
after constraint.updateEntry
#20399
Conversation
Checking `isSub` on the resulting bounds can have introduced new constraints, which might allow us to replace the type parameter entirely.
3a1c2c5
to
49940ee
Compare
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. Let's hope it addresses the performance to some degree.
@jchyb Can you also take a look and see how it performs? Thank you. |
I can't see any difference in how the reproduction performs, unfortunately. I tried printing out what's happening here and it looks like in all of the problematic cases in the reproduction the upper bound starts out as |
Are the two |
In scala#20120, we reach constraints with equal bounds that are intersection types, they are formed from multiple successive calls to `addOneBound`. We miss the `replace` optimization in this case because the bounds only become equal progressively, and we are only checking for equality with the constraint being added. The second tryReplace after updateEntry and isSub does not address this specific issue but scala#19955.
They are, but |
@jchyb could you measure it once more ? Sorry about the numerous attempts, I do hope this'll be the last one. Thanks again! |
Great, glad to hear it !
Your minimisations were very helpful too |
@odersky still good to merge ? |
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
Wonderfull news about fixing the issue! Great job! I'll try it tomorrow on whole project to check how it applies on the big scale and how it now compares to Scala 2.13 |
Nice fix, @EugeneFlesselle ! |
Checking
isSub
on the resulting bounds can have introduced new constraints, which might allow us to replace the type parameter entirely.Fix #20120
Close #20208 the original implementation