flathub / org.libreoffice.LibreOffice

https://flathub.org/apps/details/org.libreoffice.LibreOffice
29 stars 18 forks source link

Strip whitespace from .ui files #273

Closed wjt closed 5 months ago

wjt commented 5 months ago

I noticed today that of the 764 MB that makes up this app, 33 MB is taken up by .ui files describing the user interface. For example files/libreoffice/share/config/soffice.cfg/modules/simpress/ui/notebookbar.ui alone is 1,122,131 bytes.

GtkBuilder XML is a very verbose format, but I noticed that these are shipped with their whitespace intact. I carried out a quick test of running all these files through xmllint --nonet --noblanks to strip semantically-meaningless whitespace. (GNOME applications often do this via glib-compile-resources, which can be configured to strip whitespace prior to embedding the XML into the executable.) The resulting files total 21 MB, which means the remaining 12 MB is whitespace. With whitespace removed files/libreoffice/share/config/soffice.cfg/modules/simpress/ui/notebookbar.ui is 586,432 bytes: 52% of the original size. Of course whitespace compresses well in transit, but it would be nice to not have to transmit or store it!

One option would be to post-process the files as part of building the Flatpak, but I imagine that it may also be interesting upstream.

stbergmann commented 5 months ago

but I imagine that it may also be interesting upstream.

Indeed. If you feel like it, it would be great if you could move this bug upstream, see https://wiki.documentfoundation.org/QA/BugReport.

wjt commented 5 months ago

Thanks, I filed https://bugs.documentfoundation.org/show_bug.cgi?id=159287.

stbergmann commented 5 months ago

Thanks, so lets close this issue in favor of the upstream one.