context: Defer and therefore batch forced GC runs [performance]
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
That's too much.
We now defer the forced GC runs by 10 seconds, which provides two significant performance benefits:
Animations triggering garbage collection are unlikely to have their performance adversely affected by the run because the animation will be finished before it starts.
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)