Skip to content

context: Defer and therefore batch forced GC runs [performance]

Daniel van Vugt requested to merge vanvugt/gjs:defer-forced-gc into master

Since commit e9e96955, forced GC runs get queued very often in some cases. For example, during the gnome-shell icon spring animation around 60% of gnome-shell's CPU time was spent in trigger_gc_if_needed. That's too much.

We now defer the forced GC runs by 10 seconds, which provides two significant performance benefits:

  1. Animations triggering garbage collection are unlikely to have their performance adversely affected by the run because the animation will be finished before it starts.

  2. The total number of garbage collection runs is much lower because they're more likely to have been batched into the same run.

This has the observed benefit, for example, of reducing the CPU usage of the gnome-shell icon spring animation from 78% to 47% on an i7-7700 (a 40% relative reduction).

Closes: gnome-shell#582 (closed)

Helps with mutter#232 (closed), mutter#233 (closed), gnome-shell#349 (closed).

Edited by Daniel van Vugt

Merge request reports