olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.75k stars 230 forks source link

Freezes When Moving From One Text to Another (100% CPU Usage) #819

Open regielya opened 3 years ago

regielya commented 3 years ago

My book is getting larger and larger (more than 200K of text currently) and Manuskript becomes unsuable when im trying to change the text section in the Outline (to edit another chapter). It freezes for a number of seconds - really irritating and makes editing a nightmare. Checked Activity Monitor - one of my CPU threads is on 100% when that happens. It's a very strong i9-9900 (8 core 16 threads) CPU (coupled with 32GB of RAM), shouldn't even blink with an app like this.

*Tried canceling Auto Save & Revisions, problem persists.

Using the latest Debian Stable & official repo's Manuskript.

Any idea what's wrong, and is it a known issue with a fix on the way?

Thanks for a wonderful software <3

TheJackiMonster commented 3 years ago

Maybe it is using spell-checking which usually applies on opening texts. One major problem is definitely that most functionality in manuskript is still single-threaded. So implementing multi-threading for tasks which parse huge text files could enhance the application overall.

marosoft commented 3 years ago

I am not sure how the spell checking is implemented. I think it would make sense to not to do it just after opening a text but few seconds later. Another thing that could be done is to do the spell checking of the current paragraph only and have an option to do it for the whole text adhoc.

TheJackiMonster commented 3 years ago

@marosoft Yes, I addressed this on another issue (#280). Basically we could put the spell checking into a separate thread so it wouldn't slow down the GUI an its interaction.

thewithz commented 3 years ago

If spell checking is a slow operation, then would it make sense to cache the checks? Presumably, if the text is already written and spellcheck was on, then the checks were already performed, and because the text hasn't changed, then there's no reason to recalculate the information.

TheJackiMonster commented 3 years ago

@TheWithz That's exactly what I implemented in the new spell checker using languagecheck. Unfortunately there are still some other issues regarding that spellchecker (see #832) but I'm going to fix these hopefully soon. I can also look into the other spell checking (most common is enchant probably) to add a cache if not implemented yet.

Maybe we can even adapt the spell checking to iterate over parts of the text only while editing. So the iteration over the full text has to be done only once when loading the file.

tustin2121 commented 1 month ago

Did anything come of this? Because I'm having this issue too. Turning off spell check makes changing text fast, but I kind of need spellcheck...