KEMBAR78
Fix union simplification performance regression by JukkaL · Pull Request #12519 · python/mypy · GitHub
Skip to content

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Apr 4, 2022

#11962 can generate large unions with many Instance types with
last_known_value set. This caused our union simplification algorithm
to be extremely slow, as it hit an O(n**2) code path.

We already had a fast code path for unions of regular literal types. This
generalizes it for unions containing Instance types with last known
values (which behave similarly to literals in a literal type context).

Also fix a union simplification bug that I encountered while writing tests
for this change.

Work on #12408.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2022

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JukkaL JukkaL merged commit 4ff8d04 into master Apr 5, 2022
@JukkaL JukkaL deleted the faster-union-simplify-2 branch April 5, 2022 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants