-
Notifications
You must be signed in to change notification settings - Fork 112
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
High CPU and memory usage with long misspelled words #56
Comments
Thanks for the report; I've confirmed the same buggy behavior on my own machine. Not only does it take longer to retrieve suggestions for longer words, it takes exponentially longer based on the number of letters in the misspelled word:
|
bf580be helps by not saving edit-2-distance possible suggestions in memory unless they're actual dictionary words. |
Still takes about 7 seconds to lookup suggestions for
I wonder if there is any way to do a faster rejection of long word suggestions, because there are so few of them in the dictionary. Like index them all by character length, so you only have to compare a word against other words of similar length. |
4aa8162 improves memory usage further, reducing the usage for the |
Yup, down to about 166 MB RAM now, but still takes 7 seconds. Good progress tho!
|
…uggestions and is way more maintained Typo js is very very slow at suggestions for long misspelled words! It's also not as popular atm. See cfinke/Typo.js#56
sorry guys, had to move to nspell, as this bug was causing noticeable lag here: nspell doesn't have the delay when suggesting difficult words. Will consider going back to typo.js if this is fixed 👍 My suggestion here is to have a look at how nspell does it and copy the approach The issue for me is not the cpu/memory, as much as the HUGE delay (over 7 seconds looks like a bug to the user) |
You guys might want to grab my changes from over at hunspell-spellchecker. Lookup for alternatives is a lot faster if you pre-build a dictionary tree. |
Hello, and thank you for developing this module. We need more pure JavaScript solutions like this!
I noticed that when trying to lookup suggestions for long words, the library seems to chug resources and lag pretty hard. The word
djfhjfhdjfhskdfhskhdfksjdfhksdjfhksdf
takes over 7 seconds to process using typo-js, and the Node process ends up eating over 800 MB of RAM.Example code:
Output:
This is on a late 2016 MacBook Pro (2.9 GHz Intel Core i7) with OS X 10.12.3 and Node.js v6.9.1.
The text was updated successfully, but these errors were encountered: