50% speed increase for suggest call #41
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've done some performance tweaking for the suggest call. No changes to api, no changes to results. Algorithm remains the same. This removes some redundancy in processing.
edits1
by about a half just by removing duplicatesself.checkExact
rather thanself.check
as we will only be looking for exact matches here andself.check
just introduces extra processing.Here's some stats from some test words...
takr
es6: 52ms
polyfil: 54ms
original: 115ms
55% faster
hoouse
es6: 134ms
polyfil: 133ms
original: 200ms
33% faster
suggestionsr
es6: 590ms
polyfil: 598ms
original: 1201ms
51% faster
dsdsfdsfdsfdfsdfsdfsdf
es6: 3105ms
polyfil: 3116ms
original: 5676ms
46% faster