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

Better fuzzy-matching algorithm (n -> logn) #572

Merged
merged 1 commit into from
Jul 13, 2015

Conversation

k-bx
Copy link
Contributor

@k-bx k-bx commented Jul 13, 2015

I noticed that you merged my previous PR (thanks!), this PR is an improvement from what was asked there.

Copy of my comment from there:

@snoyberg I updated function to be better in terms of alg complexity. It now uses Map.splitLookup to do a logN-split, filtering smaller elements. It then filters bigger elements by doing takeWhile (takes only satisfying head).

Thus, I think I don't understand your comment in full. Since we're only running this algorithm for one package (I tested, if two packages didn't match we still fail and error only for the first one), the map-reconstruction for better version-matching wouldn't make a lot of sense. Might be that it would make sense in future, when we show errors for many packages at once.

@snoyberg
Copy link
Contributor

I may not be reading everything carefully enough. I thought it was possible to be generating more than one fuzzy-error-message at a time, in which case generating a package version lookup Map in advance and sharing it for multiple fuzzyLookupCandidate calls would help with the overhead. But I could be mistaken.

Your call on whether this should be merged: I see it as an improvement, but you understand the code better than I do.

And TIL about splitLookup, which is good :)

@k-bx
Copy link
Contributor Author

k-bx commented Jul 13, 2015

@snoyberg yeah, as soon as we want multi-package-error-reporting we might need a bigger refactoring as you noted, but it would be an overkill to do right now for single-error case.

I'm +1 for merging this, as it seems as quite simple improvement.

p.s.: I also didn't know about splitLookup before this :)

snoyberg added a commit that referenced this pull request Jul 13, 2015
Better fuzzy-matching algorithm (n -> logn)
@snoyberg snoyberg merged commit 5517987 into commercialhaskell:master Jul 13, 2015
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