Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Blaisorblade opened this issue Aug 1, 2014 · 2 comments

Comments

@Blaisorblade
Copy link
Member

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.

@Toxaris
Copy link
Contributor

Toxaris commented Aug 5, 2014

See this email for some pointers about how to implement unification efficiently.

@Blaisorblade
Copy link
Member Author

Thanks! 👍

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

No branches or pull requests

2 participants