wysiib / linter-languagetool

Integration of Languagetool into the Atom text editor.
MIT License
17 stars 5 forks source link

High cpu usage with long txt files #27

Closed IjonFryderyk closed 6 years ago

IjonFryderyk commented 6 years ago

Hi, I use your plugin every day. It is great :). Unfortunately when I work with long text files language tool plugin consumes 100% cpu power. I guess it's because plugin (linter?) scans (checks) whole document at once, not just the new sentence. Is it possible to make same workaround and, for example, manually exclude some files from being linted? Maybe you've got other ideas? I would be grateful for any help.

wysiib commented 6 years ago

First of all: Thanks!

However, I fear improving performance is not that easy: LanguageTool needs a certain amount of context to check properly. So far, I do not see how we could extract only the necessary changes from an Atom editor pane. This is a problem shared by all linter plugins, hence, I am going to check how they proceeded.

Are you using a local language tool server or the official one?

IjonFryderyk commented 6 years ago

I use local languagetool server because it doesn't have character limit (official server accepts up to 20000 characters). Are there any other servers that accept more characters? Does using remote server resolves problem of high cpu usage? I have noticed that local languagetool server used as stand-alone desktop program works similar as linter-languagetool plugin – it checks whole text at once but consumes much less cpu power. I think that LibreOffice languagetool plugin works in different way – it checks only new/changed part of text remembering previous mistakes. But I guess these aren't useful hints :).

hesstobi commented 6 years ago

Possible workarounds to avoid the high CPU usage are:

IjonFryderyk commented 6 years ago

Thanks for the workaround. I've changed Lint on Change Interval form 300 to 800 ms. CPU is still quite busy but it is a lot better than before and I can work with long files.