Zinggi / DictionaryAutoComplete

This adds dictionary entries to the completions inside comments. For lazy typers!
Other
93 stars 19 forks source link

Inefficient lookup structure #17

Closed Hunter-Github closed 6 years ago

Hunter-Github commented 9 years ago

Relevant code:

    def get_autocomplete_list(self, word):
        autocomplete_list = []
        # filter relevant items:
        for w in self.word_list:

It is obvious that the simple list structure used here is hugely inefficient. A suffix tree would have much lower lookup complexity and would not drag down the editor - autocompletion feels laggy on less than cutting edge machines and in high load environments.

Zinggi commented 9 years ago

You're completely right, thanks for pointing that out. I'm currently on vacations and can't do anything about it. I could accept a pull request, so if you want to improve it yourself go ahead.

Hunter-Github commented 9 years ago

Thanks, will have a look.

LukasKalbertodt commented 8 years ago

Any update? ;)

Zinggi commented 8 years ago

Nope, sorry. Besides, I don't think this snippet is really responsible for any slowdowns. I think it's more likely that this slowdown is caused by the sheer number of auto-complete suggestions that you get when typing a single letter, so your other suggestion would most likely solve this.

Also, if there really is a noticeable difference with a different data structure would of course have to be profiled first.

kpym commented 6 years ago

Since 677bad537b0698301bdbce1d6ca005eef50ffc4d the flat word list is replaced by one level prefix dictionary. The length of the prefixes is controlled by minimal length settings parameter.

By default (for backward compatibility reasons) this parameter is 1. But if you want to speed up this plug-in you can change it to 2, 3 or maybe 4.

kpym commented 6 years ago

If you combine "minimal length": 3 with "maximum results": 10 in DictionaryAutoComplete.sublime-settings the complexity is highly reduced.