Skip to content

Union normalization performance #1237

@ibraheemdev

Description

@ibraheemdev

The new collection literal inference is running into problems with the performance of union type normalization. Aggressive literal promotion helps avoid generating large unions, but sometime it is unavoidable. For example, this dictionary in mitmproxy, or this list in CPython.

I'm not sure if there's potential to improve the performance of normalization itself, or if we should fallback to a wider type if the union of the element types grows too large. It does feel like there's some exponential behavior here that should be avoidable, as the issue arises for unions that are only ~10 elements large.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePotential performance improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions