fuzzy
fuzzy copied to clipboard
Added sublime fuzzy search behavior.
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.
:+1:
Awesome! Have you run any benchmarks to test performance?
Haven't run benchmarks yet. Will try to do so in the next few days and update.
Any update on this? new features added by @kseth would be awesome
@zeronote I'm concerned about performance with the changes. @kseth any updates?
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.
Fixes #3
Any update on the status of this pull request?
@mattyork anything we can do to speed this up?
any update here?
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