alienhard / SublimeAllAutocomplete

Extend Sublime autocompletion to find matches in all open files of the current window
917 stars 110 forks source link

CPU spike when typing #5

Closed samuelhwilliams closed 11 years ago

samuelhwilliams commented 11 years ago

Today, whenever I am typing in Sublime Text 2 the program hangs turns dark grey with the text I am inputting not visible on the screen. When I stop typing and wait patiently, the text will eventually appear again. I watched the CPU activity while typing and it would jump up to 95%+ until it calmed down again. This appears to be caused by the All Autocomplete package - when I uninstall it, ST2 works fine, and when I reinstall it, the problem returns.

alienhard commented 11 years ago

Thanks @samuelhwilliams for reporting the issue!

Have you been using this package before without noticing the problem?

I wonder whether this is related to the recent workaround we added (issue #3 and #4) which searches through each view for each word. I've been using the new version for several days and haven't noticed any slowdown so it may only happen under certain conditions.

If you feel like helping me debug this, I'd be happy if you could revert to the previous version and tell me whether the problem exists there too:

https://github.com/alienhard/SublimeAllAutocomplete/blob/cd54801333b87f5f7f954b5c06f09da829360723/all_views_completions.py

Anyone else seeing this problem?

samuelhwilliams commented 11 years ago

Hi alienhard,

Thanks for the quick response!

Yep, I've used this package now for probably 6+ months without an issue. It was only on the day I posted that I've ever seen something like this happen before. However, replacing the contents of the "all_view_completions.py" file with the code you supplied seems to have stopped the problem from showing up.

alienhard commented 11 years ago

Thanks @samuelhwilliams

So apparently the recent change for issue #4 causes this problem. I've tried to come up with a version that adds limits to the amount of work we do, and this may solve your issue. But I'm really just guessing since I can't reproduce on my machine. Would you mind trying this new version and let me know whether it works?

The code is here: https://gist.github.com/4193267

samuelhwilliams commented 11 years ago

That seems to have done the trick! Thank you so much - great plugin and fantastically fast responses :+1:

alienhard commented 11 years ago

Fixed by 9097241