Skip to content

Type inference has at least quadratic complexity because of immutability & bad algs. #4

Open
@Blaisorblade

Description

@Blaisorblade

I just realized that the repeated substitutions inside unification are quadratic, which seems bad, and hopefully can be improved upon. (Maybe this requires mutation for unification variables).

I imagine looking up type variables when matching them, and substituting them later, might be better (not sure, but the lookup is at least O(1), so it seems a matter of constant factors ).

Using mutation (and treating a resolved variable as the type it resolves too everywhere needed) might be an alternative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions