GNOME Bugzilla – Bug 773054
High CPU usage due to huge spinner
Last modified: 2016-10-24 23:05:36 UTC
Since the merge of https://bugzilla.gnome.org/show_bug.cgi?id=765516, it looks like Geary UI is getting greedy with the CPU. Following measures are made with top and last through time: - on idle (eg. only Geary's service running, no UI), Geary consumes around 0% CPU - when the huge conversation spinner is displayed, Geary consumes around 54% CPU - when a conversation (7 mails) is selected and displayed, Geary consumes around 5% CPU - when a folder with no message is displayed (so no spinner nor conversation displayed), Geary consumes around 1.5% CPU I did not test before the merge happened, but if needed I can do so.
Hmm, does the spinner still animate when not visible? I'm seeing Geary on 0% when actually idle — i.e. nothing being printed when launched with "-d". Of course, the only time the spinner should be visible is when the engine is busy in the background, and hence Geary will be be using a non-trivial amount of CPU. If you can do some testing and/or some patching around the conversation viewer's two spinners, I'd be happy to look at it. Note also some of changes to how WebKit is embedded in Bug 765516 may have also contributed to this, and will get shook up further with the port to WK2, so it's probably not worth putting too much effort into issues specifically there for now. I'll flag this for 0.12 so if nothing else it should be revisited after WK2 lands but before the release.
Just pushed commit 8ea5e3c to master, which should make the spinner go away after the folder has finished loading when autoselect is off. Still not sure why your spinner is epic-sized though.
Michael, it seems you inverted if/else condition in the patch (oops!).
Hm, actually it is not that; yet the "autoselect=off" option is broken and Geary always selects the next conversation.
Really? That's weird. This is what I see after 8ea5e3c: Auto select pref is ticked: Click on a folder, spinnner appears when loading. When loaded first conversation in list is selected and displayed. Auto select pref is unticked: Click folder, spinnner appears, no conversation is selected and "No conversation selected" UI is shown when loaded. What are you getting?
Yes that is working great, but there are 2 other uses cases (at least): 1. Select a conversation, delete it. If autoselect is unticked, you should then have the "No conversation is selected" UI. Currently, it automatically selects the next one, as if autoselect is ticked (regression) 2. It looks like the spinner goes away too soon, eg when the first mail of the conversation is loaded or so. Here is a video sample: http://www.webm.land/w/xPGA/ I selected a conversation, then the spinner went back and forth until finally the conversation was shown.
Oh I see - I can reproduce both of those, will look into it.
Hey, I just pushed commit 310daa8 to fix (1) and commit 0e5df2c which should fix (2). Do they work for you?
Yeah, thanks! All looks great now. There remain only 2 issues(?) in that bug: 3) Huge conversation spinner is expected to be smaller? 4) Higher CPU usage when a conversation selected (between 20 and 50%). I would expect it to end to 5% (as when nothing is selected), any idea what can cause extra CPU usage?
Created attachment 338217 [details] [review] Fix for huge spinner Hey Gautier, this patch may fix the huge spinner, can you please test it out and let me know if it does?
Not sure about the CPU, but as I mentioned it may well change after the WK2 port, so I'm not too inclined to look at the until after that lands and it remains an issue.
> Hey Gautier, this patch may fix the huge spinner, can you please test it out and let me know if it does? Indeed it does! It is now a nice 32x32 icon. > I'm not too inclined to look at the until after that lands and it remains an issue. Seems fair; I think this bug can be close then (since spinner bug is fixed) and I'll open a new one after WK2 port lands in master, if needed.
Review of attachment 338217 [details] [review]: Pushed to master as commit 797bb44.
Sounds like a good plan, thanks for testing it out.