Unassorted performance fixes
Some patches from https://bugzilla.gnome.org/show_bug.cgi?id=782344 in MR form. Some of the other patches will be handled through separate MRs.
NB: This branch reintroduces the patch that caused https://bugzilla.gnome.org/show_bug.cgi?id=784314, gtk!294 (merged) contains an updated patch for it.
Edited by Georges Basile Stavracas Neto