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.
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
[red-knot] Combine terminal statement support with statically known branches #15817
[red-knot] Combine terminal statement support with statically known branches #15817
Changes from 16 commits
02c4798
2c0d577
e198806
23b366d
38f3d99
5c1918a
7504fb7
ee6f253
6b53554
bb11cf8
a2ef702
1c42a2b
289c0c6
8b0899f
9cd8e68
1a80f81
f71325c
0e06012
b3b4577
46b1ec2
999188a
0f278da
0fb6a74
c882a95
33db6f1
b49916d
c80f27e
0d50385
c42490c
26f842b
e5b6c4a
00e236f
1d93650
ae83741
f13a6a6
7423de2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Commenting out these two
if
clauses is how we verify that this is truly an optimization — we should get the same results for the tests with and without itThere 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.
And I verified that we can indeed remove these checks and all tests pass! I'm not seeing a detectable performance improvement in the benchmark from including these lines; perhaps that just suggests conditional terminals aren't common enough for it to show up? It definitely seems like this should be faster in cases where it does apply.
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.
I think it might be that the merge step is now faster: if the other snapshot's reachability is
ALWAYS_FALSE
, then the visibility of all of its bindings should also beALWAYS_FALSE
. (I think there were cases before TDD normalization where we wouldn't be able to see that in the structure of the visibility constraint.) Merge will iterate through all of the bindings and AND their visibility constraints, but ANDing withALWAYS_FALSE
is one of the fast-path returns.To be clear, it's a hunch — I haven't backed any of ☝️ with data!