fuzzy icon indicating copy to clipboard operation
fuzzy copied to clipboard

Added sublime fuzzy search behavior.

Open kseth opened this issue 10 years ago • 11 comments

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.

kseth avatar Sep 17 '15 22:09 kseth

:+1:

vors avatar Sep 17 '15 22:09 vors

Awesome! Have you run any benchmarks to test performance?

mattyork avatar Sep 19 '15 21:09 mattyork

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

kseth avatar Sep 29 '15 22:09 kseth

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

zeronote avatar Feb 25 '16 10:02 zeronote

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

mattyork avatar Feb 25 '16 16:02 mattyork

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.

kseth avatar Feb 28 '16 07:02 kseth

Fixes #3

mattyork avatar Sep 25 '16 19:09 mattyork

Any update on the status of this pull request?

qisaw avatar Nov 03 '16 00:11 qisaw

@mattyork anything we can do to speed this up?

smith-kyle avatar Apr 24 '17 18:04 smith-kyle

any update here?

Ab1d avatar Sep 07 '18 09:09 Ab1d

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

Nexucis avatar Aug 21 '20 14:08 Nexucis