GNOME Bugzilla – Bug 790269
consider dropping compressed=true for widget ui files
Last modified: 2018-05-02 19:27:27 UTC
Currently, the gresource embedding of .ui files for widgets compresses the file (without stripping blanks first). Probably fine since the compression will run-length-encode the spaces anyway. But there is a secondary issue here, in that it means we have to use a zlib decompressor when ever instantiating one of these widgets. Gtk is mapped into many processes, and therefore the library size shouldn't be important enough to warrant the compression (plus packaging already compresses so users are unlikely to download any larger files). I suggest we instead simply xml-stripblanks and stop using compression on the .ui files. It should (very slightly) speed up application startup, reduce our heap usage, and make widget creation faster.
Created attachment 363459 [details] [review] use xml-stripblanks and drop compression use for widgets
(In reply to Christian Hergert from comment #0) [...] > But there is a secondary issue here, in that it means we have to use a zlib > decompressor when ever instantiating one of these widgets. From what I recall discussing with Allison at the time, the above is not *entirely* true. The activity of decompressing a GResource, should really only be happening the first time. However, on a desktop like system as opposed to a kiosk/embedded scenario where one might run only a few applications for a long uptime, we should consider that the user spawns many separate applications and a *lot* of the time, when we instantiate a GTK+ widget on a desktop, it happens to be the first time in that executable's lifespan (so the effect for normal desktop GTK+ usage is as you describe). That said, I seem to recall that Juan Pablo had been working on a much nicer approach for optimizing widget instantiation: Seeing as we now use GResources anyway, binary compatibility is not really an issue, so a binary format for GtkBuilder is quite possible. While we still have to retain some strings in order to cooperate with the GtkBuildable interface, we should be able to get a smaller binary footprint *and* completely side-step the XML parsing by encoding the preparsed XML binary structures directly into the GResource instead of XML.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/975.