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

Added sublime fuzzy search behavior. #12

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

kseth
Copy link

@kseth kseth commented Sep 17, 2015

Fuzzy search now performs true 'sublime' like behavior.

Given a word with length n and a search query with length m, the new algorithm takes something like:
O((|n-m|+1)(m)).

Uncommented two tests.

It also has the behavior preferred by the third test (still xit): it prefers highly ranked words where the search query appears closer to the beginning of the word.

@vors
Copy link

vors commented Sep 17, 2015

👍

@mattyork
Copy link
Owner

Awesome! Have you run any benchmarks to test performance?

@kseth
Copy link
Author

kseth commented Sep 29, 2015

Haven't run benchmarks yet. Will try to do so in the next few days and update.

@zeronote
Copy link

Any update on this? new features added by @kseth would be awesome

@mattyork
Copy link
Owner

@zeronote I'm concerned about performance with the changes. @kseth any updates?

@kseth
Copy link
Author

kseth commented Feb 28, 2016

Sorry for the delay @mattyork, ran some basic performance tests comparing the PR and the existing fuzzy functionality. I ran these tests on node v5.6.0, averaged over 1,000,000 iterations, testing the fuzzy.match function.

'bass' in 'bodacious bass': 0.0012 ms (existing) vs 0.0039 ms (PR)
'rice' in 'reactive rice': 0.00085 ms (existing) vs 0.0031 ms (PR)
'abcd' in 'abcdefgh': 0.0008 ms (existing) vs 0.0015 ms (PR)

'abcd' in 'abcdefgh' should be the best case scenario for the PR and even there performance is impacted negatively by something like 2x (probably because v8 better optimizes for iteration compared to recursion). 'bass' in 'bodacious bass' and 'rice' in 'reactive rice' are expected to be slower because the PR adds functionality for finding better fuzzy matches.

I can do some more testing if you think these basic preliminary results aren't too damaging for this PR.

@mattyork
Copy link
Owner

Fixes #3

@qisaw
Copy link

qisaw commented Nov 3, 2016

Any update on the status of this pull request?

@smith-kyle
Copy link

@mattyork anything we can do to speed this up?

@Ab1d
Copy link

Ab1d commented Sep 7, 2018

any update here?

@Nexucis
Copy link

Nexucis commented Aug 21, 2020

well if you are still interesting by this feature (which will be a bit surprised, been while there is no update on this, but well just in case :D), I implemented the algo here: https://github.com/Nexucis/fuzzy

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.

8 participants