Usage of GtkStack comes with a significant performance hit
In upcoming Inkscape 1.0 we use a (homogeneous) GtkStack to implement the toolbar (children are exchanged depending on the active tool).
Recently I've discovered this is the source of very bad performance when the main window goes into backdrop (or returns into foreground). Transitions appear very unsmooth (basically two "steps" are rendered) and the user interface becomes unresponsive during that time (I'd estimate up to one second).
Now I've made an attempt to set the GtkStack to inhomogeneous (which helps a bit) but is still significantly worse than simply wrapping the toolbar widgets directly into their parent and showing/hiding them manually or (I guess that's more or less equivalent) using a GtkSizeGroup (which was used before we switches do GtkStack).
In summary:
- GtkStack (homogeneous) - very bad performance hit
- GtkStack (inhomogeneous) - performance hit
- GtkSizeGroup - performance OK
- Children directly wrapped into parent container - performance OK
It seems there's something wrong with GtkStack that causes bad performance?
From my understanding when setting the stack not to be homogeneous it should not cause any overhead compared to GtkSizeGroup or any other container?
For reference this was observed on Windows 10 with (mingw-w64-x86_64-gtk3 3.24.13-1)
Downstream issue: https://gitlab.com/inkscape/inkscape/issues/509