[webkit-gtk] WK2/JSC idle wakeups and CPU utilisation

Michael Gratton mike at vee.net
Sat Dec 2 18:44:46 PST 2017


Hi all,

Since porting Geary to WebKit2, I have noticed it seems to have been 
running hotter than previously when idle. This has also been reported 
by others in Bug 783025[0]. One person noticed using strace that when 
Geary is on the visible desktop, it is calling and returning from 
poll() at about 60 times per second, which is a substantial number of 
wakeups for an idle application. This seems to also occur for Epiphany, 
but not in other GTK+ apps such as Gitg, or Polari. Hence it looks like 
a WebKit2 issue.

I'm noticing it under Wayland, and have a query out in that bug as to 
whether others are seeing it under X11. The poll() rate decreases when 
it is not on the visible desktop, and I've managed to get the rate down 
a bit as well by ensuring Geary is not showing a WebView, but these 
aren't terribly useful workarounds. Geary is setting 
WEBKIT_DISABLE_COMPOSITING_MODE=1 in main() right after launching, but 
commenting that out doesn't seem to make any difference. I also tried 
commenting out the ~6 JS message handlers that Geary uses for 
displaying conversations, but that didn't help either.

Sysprof shows that most of the work being done when idle is in 
g_main_context_prepare() — 21% of the total, g_source_iter() — 17% 
of total, and magazine_cache_push_magazine (used by g_slice) — 12%. 
Most of the work being done by calls to g_source_iter are being made 
from libjavascriptcoregtk-4.0.so — accounting for 13% of the total 
work when idle.

Is this to be expected or is it a bug?

Cheers,
//Mike


[0] - <https://bugzilla.gnome.org/show_bug.cgi?id=783025>

-- 
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>



More information about the webkit-gtk mailing list