]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-91603: Speed up operator "|" for UnionType (GH-91955)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 28 Apr 2022 10:25:33 +0000 (13:25 +0300)
committerGitHub <noreply@github.com>
Thu, 28 Apr 2022 10:25:33 +0000 (13:25 +0300)
commitcd1fbbc81761dc26ce6daf724d57d48e965e5817
treee5ea8dd5fd0e4227fda80160f1de004a78f138f8
parent37c6db60f9ac62b8a80bf04a8146274756ee0da0
gh-91603: Speed up operator "|" for UnionType (GH-91955)

Reduce the complexity from O((M+N)^2) to O(M*N), where M and N are the length
of __args__ for both operands (1 for operand which is not a UnionType).

As a consequence, the complexity of parameter substitution in UnionType has
been reduced from O(N^3) to O(N^2).

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Misc/NEWS.d/next/Core and Builtins/2022-04-23-22-08-34.gh-issue-91603.GcWEkK.rst [new file with mode: 0644]
Objects/unionobject.c