How to reduce flatpak app size?

Alberto Fanjul Alonso albertofanjul at gmail.com
Mon Aug 6 17:38:46 UTC 2018


It is important to understand the things you want to compare.

Forget the technology, flatpaks are files for a program (same as you can
find in a deb or rpm) running on a sandbox (so all departments they need
needs to be on its sandbox). They are based on runtimes (another bunch of
files expected to be much commonly shared, just that)

So if underneath, all bunch of files use ostree (something like a git repo)
you have an initial clone and from time to time, some updates. But did you
choose correct things to measure things?

You can find all installed apps verbatim under /var/ or ~/.var/

Telegram uses KDE runtime
https://github.com/flathub/org.telegram.desktop/blob/master/org.telegram.desktop.json#L3

GIMP uses GNOME runtime.

https://github.com/flathub/org.gimp.GIMP/blob/master/org.gimp.GIMP.json#L4

Install both apps you cannot expect to share anything (maybe something for
the freedesktop SDK both runtimes share). See runtimes have different
versions too.

I suppose GIMP is 200Mb and gnome runtime is 250Mb.

I don't think low disk space usage is a goal for flatpak, but sandboxing,
so if 2 programs need same dep with different build config, that is
perfectly possible, so apps always will run better, but surely using more
space.

Do all apps need all the things a runtime bring? Surely not, if you remove
something from runtime, you need to install "n" times on "n" apps.
Maintainer do they best to decide what to put on them.

El lun., 6 ago. 2018 18:36, Michael Hall <mhall119 at gmail.com> escribió:

> Can I ask how you are installing the Flatpaks? Because Gimp from Flathub
> is only 200MB installed.
>
> Michael Hallmhall119 at gmail.com
>
> On 08/06/2018 10:31 AM, M. A. Spadaru wrote:
>
> *Hello again,*
>
>
>
>
>
>
>
>
> * Sorry for not being clear enough when describing my method. Here is a
> better description: Test: - Read used disk space: d1 - Install spotify -
> Run spotify + login + play “Manowar - Carry on” - Read used disk space: d2
> - Compute disk footprint of spotify as d2-d1 - Install VSCore - Run VSCore
> + open an existing project folder + edit and save a file - Read used disk
> space: d3 - Compute disk footprint of VSCode as d3-d2 - Install
> telegram-desktop - Run telegram-desktop + login + send a message to a
> friend - Read used disk space: d4 - Compute disk footprint of
> telegram-desktop as d4-d3 - Install Gimp - Run Gimp + open an image - Read
> used disk space: d5 - Compute disk footprint of Gimp as d5-d4 - Install
> Android-Studio - Run Android-Studio + create new project + install sdk +
> run project - Read used disk space: d6 - Compute disk footprint of
> Android-Studio as d6-d5 After a test I would uninstall the apps,
> dependencies, and settings/config files and any leftover files I could
> find, as best I could. Then proceed to the next test. I executed these 3
> tests in this order: Native, Snap, Flatpak. I read the used space on my
> disk using GParted. Since I have only one partition (except swap and
> /boot/efi), I think this method of computing the used disk space should
> cover any app files, dependencies, package format specific files and any
> config files added to /home. It should also over any files added by snapd
> and the core snap.   As pointed out by Alexander Larsson, my values seem to
> imply that I am starting from scratch downloading the runtimes for each
> flatpak application. However, this was not the case. When installing the
> GIMP flatpak, the flatpaks of Spotify, VSCode, and Telegram are already
> installed. Still GIMP needs 450MB of storage space. I also expected that
> flatpak apps would share runtimes, however this does not seem to be the
> case. So, returning to my initial question: Is it possible to reduce the
> size of this overhead of each individual app? Maybe a way to force apps to
> share runtimes?   Cheers, Mike *
> On 08/06/2018 11:14 AM, Muayyad AlSadi wrote:
>
> I guess the VSCode and alike require SDK runtime (having compiler, headers
> ..etc) which is like *-devel host packages
> snap does not ship those
>
>
> On Mon, Aug 6, 2018 at 11:37 AM Alexander Larsson <alexl at redhat.com>
> wrote:
>
>> On Thu, Jul 12, 2018 at 9:05 AM, Mike Spadaru <maspadaru at gmail.com>
>> wrote:
>> > Dear Flatpak community,
>> >
>> > I attempted a small experiment to benchmark Snap and Flatpak. On
>> > Ubuntu 16.04 I picked some apps: Spotify, VSCode, Telegram-Desktop,
>> > Gimp, Android-Studio. I performed three tests Native (via apt, .deb or
>> > PPA), Snap and Flatpak. In each test I would read the used disk space,
>> > install an app, run the app and perform a task (same task in each
>> > test), then read the used disk space again. Before moving to the next
>> > test, I uninstalled all the apps and removed any config files created.
>> >
>> > The machine uses only one disk partition. I also recorded CPU, RAM and
>> > Power consumption, but there was no clear difference between the three
>> > package formats.  My results for the disk usage are shown bellow.
>> > Values are in mega-bytes:
>> >
>> > | App | Native | Snap | Flatpak |
>> > | Spotify | 240 | 290 | 980 |
>> > | VSCode | 270 | 220 | 1030 |
>> > | Telegram | 80 | 100 | 600 |
>> > | Gimp | 80 | 200 | 450 |
>> > | Android Studio | 3290 | 3330 | 5930 |
>>
>> This is not really a fair comparison. You already have basically all
>> the dependencies of the native packages installed, so installing just
>> the app is just going to measure the app itself, whereas the flatpak
>> application will download the dependencies (the runtime) in addition
>> to the app.
>> The same happens for snap, i.e. since you're on ubuntu it will already
>> have installed the ubuntu core snap, so you're not counting that space
>> against the app.
>>
>> Also, the values you get seem to imply that you're starting from
>> scratch downloading the runtimes for each flatpak application, but
>> most apps share the runtimes so if you were to install all the
>> flatpaks at the same time the total size would not add up to the sum
>> of your measured sizes.
>>
>> A better test of snap/flatpak might be to first remove all of snapd,
>> including all snaps (thus also the core snap), then measure the free
>> space, install snapd + al* the above snaps and compare the free size
>> with before. Then do the same with all flatpaks in one install.
>> That way you will count shared things only once, and accurately
>> include the size of the snap base in the comparison.
>> _______________________________________________
>> Flatpak mailing list
>> Flatpak at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/flatpak
>>
>
>
>
> _______________________________________________
> Flatpak mailing listFlatpak at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/flatpak
>
>
> _______________________________________________
> Flatpak mailing list
> Flatpak at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/flatpak
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/flatpak/attachments/20180806/d6a7063d/attachment-0001.html>


More information about the Flatpak mailing list