-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ty] improve complex TDD-based narrowing #23201
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
Open
mtshiba
wants to merge
75
commits into
astral-sh:main
Choose a base branch
from
mtshiba:improve-23109
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,645
−482
Open
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
c6ad1e8
[ty] improve #23109 TDD-based narrowing
mtshiba 989268d
cache `narrow_by_constraint_inner`
mtshiba 7f8379c
refactor
mtshiba f92287c
further `narrow_by_constraint_inner` optimization
mtshiba a0a5213
Revert "further `narrow_by_constraint_inner` optimization"
mtshiba 6909252
improve constant calculations with `resolve_to_literal`
mtshiba 0e2ca45
further `narrow_by_constraint_inner` optimization (take 2)
mtshiba ae801f7
Revert "improve constant calculations with `resolve_to_literal`"
mtshiba 8369501
Revert "further `narrow_by_constraint_inner` optimization (take 2)"
mtshiba b2e63ce
Reapply "improve constant calculations with `resolve_to_literal`"
mtshiba c9aa05b
Merge branch 'main' into improve-23109
mtshiba 946ea42
Update place_state.rs
mtshiba b45d185
`narrow_by_constraint` optimization (take 3)
mtshiba f10df50
Revert "`narrow_by_constraint` optimization (take 3)"
mtshiba de6d3c1
Reapply "`narrow_by_constraint` optimization (take 3)"
mtshiba 4eb12c8
add `PlaceVersion` to prevent the old shadowed narrowing constraint f…
mtshiba 19e63c4
`narrow_by_constraint` optimization using `PlaceVersion`
mtshiba 50fc1e9
`narrow_by_constraint` optimization using `UnionType::from_elements_w…
mtshiba cfa026c
Revert "`narrow_by_constraint` optimization using `UnionType::from_el…
mtshiba 41059e9
optimization in `PredicatePlaceVersionInfo`
mtshiba cd6c0ef
remove `ReturnsNever` special casing
mtshiba 8468a9e
remove `all_negative_narrowing_constraints_for_{expression, pattern}`
mtshiba c2fe06e
compact `PredicatePlaceVersions`
mtshiba 6da3546
Revert "compact `PredicatePlaceVersions`"
mtshiba 3c0be32
store place versions per definition in `UseDefMap`
mtshiba 9142acd
remove `latest_place_version` from `Bindings`
mtshiba b0add5e
intern `bindings_by_use`
mtshiba fd02b2b
Revert "intern `bindings_by_use`"
mtshiba 2938e78
follow review
mtshiba 986a678
Merge branch 'main' into improve-23109
mtshiba 432e7d4
Update narrow.rs
mtshiba 8bff224
fix `L/RShift` implemenation in `resolve_to_literal`
mtshiba a3eb0ab
add unit tests for `resolve_to_literal`
mtshiba 04dfb49
Revert "remove `latest_place_version` from `Bindings`"
mtshiba c002ce6
remove unnecessary code
mtshiba 99ad21f
Merge branch 'main' into improve-23109
mtshiba 65bdd1c
remove unnecessary code
mtshiba c1c0757
simplify `narrow_by_constraint_inner` logic
mtshiba 3edbfdf
reduce redundancy checks in `narrow_by_constraint`
mtshiba 56dd816
reduce redundancy checks in `narrow_by_constraint` (2)
mtshiba 3e05314
memorize all return values in `narrow_by_constraint_inner`
mtshiba 6b11b17
narrowing constraint id canonicalization
mtshiba c171e96
[ty] Propagate narrowing through always-true if-conditions
mtshiba fdd4d9f
Revert "[ty] Propagate narrowing through always-true if-conditions"
mtshiba 4b1398c
Update reachability_constraints.rs
mtshiba 5d984f4
disable non-effective cache
mtshiba f755755
Revert "disable non-effective cache"
mtshiba 7e82288
disable non-effective cache (take 2)
mtshiba 56c5011
Revert "disable non-effective cache (take 2)"
mtshiba 738cf8d
cache two types intersection as a tracked function
mtshiba a1e303e
`NarrowingConstraint` has `Cunjunction`s
mtshiba 2c8bade
add `GatedNarrowingConstraint`
mtshiba 5b6f7f2
intern `NarrowingConstraint`
mtshiba 3d60f3f
Merge branch 'main' into improve-23109
mtshiba a596400
revert `add `GatedNarrowingConstraint``
mtshiba fb05c74
cache two types union as a tracked function
mtshiba f476d36
Revert "cache two types union as a tracked function"
mtshiba 50c976c
cache two types intersection as a tracked function (take 2)
mtshiba adb4472
use `IntersectionType::from_two_elements` more
mtshiba 5c321a0
add fast path for intersection type redundancy check
mtshiba 9363927
avoid expensive intersection type checks
mtshiba 1c8120b
add benchmark for large union type narrowing
mtshiba 71f41f1
Merge branch 'main' into improve-23109
mtshiba 50b9866
Update post_if_statement.md
mtshiba 64d2a86
remove unnecessary code
mtshiba c913247
Revert "remove unnecessary code"
mtshiba 0030056
add `MAX_NARROWING_GATING_MERGES`
mtshiba 9623224
Revert "add `MAX_NARROWING_GATING_MERGES`"
mtshiba a82538c
more aggressive short circuit in `Bindings::merge`
mtshiba 52c4104
optimize `narrow_by_constraint_inner`
mtshiba 27e5778
Merge branch 'main' into improve-23109
mtshiba 736aeeb
experiment: revert "optimize `narrow_by_constraint_inner`"
mtshiba 4f2ce84
Revert "experiment: revert "optimize `narrow_by_constraint_inner`""
mtshiba 89eb8f9
tracked `evaluate_constraint_type`
mtshiba f251ccb
Revert "tracked `evaluate_constraint_type`"
mtshiba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
6 changes: 6 additions & 0 deletions
6
crates/ty_python_semantic/resources/mdtest/binary/integers.md
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
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
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
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
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
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
Oops, something went wrong.
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.
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 benchmark currently shows up as "new" in the codspeed report, so we can't see how much this PR improves performance on this benchmark relative to
main. It might be better to add this benchmark in a standalone PR, wait for codspeed to finish on that PR branch, and then rebase this PR on top of that PR branch. Then Codspeed should tell us how much this PR improves performance on this benchmark.