[ty] avoid costly computations in intersection type construction#23555
Open
mtshiba wants to merge 4 commits intoastral-sh:mainfrom
Open
[ty] avoid costly computations in intersection type construction#23555mtshiba wants to merge 4 commits intoastral-sh:mainfrom
mtshiba wants to merge 4 commits intoastral-sh:mainfrom
Conversation
Typing conformance resultsNo changes detected ✅ |
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownflake8
trio
sphinx
prefect
|
Merging this PR will improve performance by 59.61%
Performance Changes
Comparing Footnotes
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unresolved-attribute |
0 | 0 | 3 |
invalid-return-type |
0 | 0 | 1 |
unsupported-operator |
0 | 0 | 1 |
| Total | 0 | 0 | 5 |
60db1be to
b5cce8f
Compare
b5cce8f to
c70f62a
Compare
This reverts commit c70f62a.
mtshiba
commented
Feb 26, 2026
| // Fast path for intersection types: use set-based subset check instead of | ||
| // the full `has_relation_to` machinery. This is critical for narrowing where | ||
| // many intersection types with overlapping positive elements are produced. | ||
| if let (Type::Intersection(self_inter), Type::Intersection(other_inter)) = (self, other) { |
Member
|
I'm a little unsure about the specific assumptions being made here, because both of the changes seem theoretically unsound, though maybe fine in practice. I'd like to get another opinion before merging this. |
Member
|
I can take a look tomorrow |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
From #23201
Test Plan
No-op