GNOME Bugzilla – Bug 768306
Constantly high CPU usage when using spell checking
Last modified: 2016-07-09 13:43:52 UTC
gedit seems to have a constantly high CPU usage in certain situations when using spell checking. I've found the following way to reproduce this issue: 1. start gedit 2. enable "Highlight Misspelled Words" 3. enter "gggggggggggg", but to not press enter or space The CPU usage remains high until enter or space is pressed (or anything else that would cause it to start spell checking). The CPU usage seems to be even higher if there is more text and sysprof shows a lot of _gtk_text_line, pango, harfbuzz and cairo calls. This could indicate, that the sourceview (or parts of it) is getting constantly redrawn.
Thanks for the bug report. I'll look at it when I have the time. It's most probably a problem in gspell (and/or an interaction with GtkSourceView). The gedit plugin doesn't do a lot of work anymore. So re-assign to gspell.
I actually can't reproduce the infinite loop. Back to gedit. I have tested with git master (in jhbuild) and with GNOME 3.20. Which versions of GTK+, GtkSourceView, gspell and gedit do you have? Try with all gedit plugins disabled, except the spell plugin of course. Try also with the overview map and grid pattern disabled (if they are enabled).
Also, with which Linux distribution?
I'm seeing this issue on Fedora 24. I can still reproduce it with all other plugins disabled. Also I don't use the grid pattern or the overview. gspell-1.0.2-1.fc24.x86_64 gedit-3.20.2-1.fc24.x86_64 gtk3-3.20.6-1.fc24.x86_64 gtksourceview3-3.20.4-1.fc24.x86_64 glib2-2.48.1-1.fc24.x86_64 You could also try pasting some random text in there first to make the redraws more expensive. Maybe that makes it more noticeable on a faster computer.
Now I can reproduce the problem. It's because I tested with "gggggg" as the only content. When there is more text (after loading a file, for example), then I can indeed see that the CPU usage is high (but not at 100%, because the infinite loop has probably a maximum of 60 iterations per second with a typical screen).
I confirm it's a bug in gspell. It's not an interaction with GtkSourceView, because the bug happens also when only GtkTextView is used.
Fixed with commit 586959c0bd439c767869f556baafa560057280d5. I'll backport the commit to the 1.0 version.
Released gspell 1.0.3 with the fix.