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

Speed up comparison of environments #44

Merged
merged 2 commits into from
Jul 29, 2016
Merged

Conversation

gullcomb
Copy link

When comparing environments, the declarations are unnecessarily compared, as they almost always come from the same source code (cf. #38). This pull request removes these unnecessary comparisons by annotating the declarations with their location in the code and comparing these first.
Note that the implementation can become unsound if nested mutual block are allowed (currently, resolveNonMutualDecl will just crash).

Also fixes one unrelated regression: cubical no longer builds on GHC 7.8.

Guillaume Combette added 2 commits July 12, 2016 16:42
This version does not implement the Foldable/Traversable in Prelude
proposal thus `elem` does not work on Sets.
This speeds up the comparison of environments in the common case of
identical declarations.
@mortberg
Copy link
Owner

Looks good to me.

@mortberg
Copy link
Owner

I did some benchmarks and it makes things a lot faster. The only drawback is the problem with nested mutual blocks. However we never use this and I can add a comment saying that it is not supported (and maybe make the resolver not crash but print an error message). If we ever need nested mutuals we can either revert these changes or come up with something that works. Does this sound good? Unless someone objects I'll merge this soon.

@mortberg mortberg merged commit 9dcb73b into mortberg:master Jul 29, 2016
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