Testing default snap apps against equivalent deb apps - slow start times

Here are the results.
Gnome Calculator snap

$ snap run --trace-exec gnome-calculator

Slowest 10 exec calls during snap run:
0.381s snap-update-ns
0.505s /usr/lib/snapd/snap-confine
0.253s /snap/gnome-calculator/501/gnome-platform/usr/sbin/update-icon-caches
0.213s /snap/gnome-calculator/501/gnome-platform/usr/sbin/update-icon-caches
1.035s /snap/gnome-calculator/501/gnome-platform/usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules
1.513s /snap/gnome-calculator/501/gnome-platform/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
0.212s /snap/gnome-calculator/501/gnome-platform/usr/bin/gtk-update-icon-cache
0.260s /snap/gnome-calculator/501/gnome-platform/usr/sbin/update-icon-caches
0.830s /snap/gnome-calculator/501/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0
5.375s /snap/gnome-calculator/501/bin/desktop-launch
Total time: 20.503s

Removed gnome-calculator snap and installed the deb gnome-calculator.

$ time gnome-calculator

real 0m4.712s
user 0m0.879s
sys 0m0.123s

Gnome system monitor snap

$ snap run --trace-exec gnome-system-monitor
Slowest 10 exec calls during snap run:
0.270s snap-update-ns
0.377s /usr/lib/snapd/snap-confine
0.101s /snap/gnome-system-monitor/100/gnome-platform/usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules
0.177s /snap/gnome-system-monitor/100/gnome-platform/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
0.109s /snap/gnome-system-monitor/100/gnome-platform/usr/sbin/update-icon-caches
0.110s /snap/gnome-system-monitor/100/gnome-platform/usr/sbin/update-icon-caches
0.192s /snap/gnome-system-monitor/100/gnome-platform/usr/bin/gtk-update-icon-cache
0.215s /snap/gnome-system-monitor/100/gnome-platform/usr/sbin/update-icon-caches
0.213s /snap/gnome-system-monitor/100/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0
6.324s /snap/gnome-system-monitor/100/bin/desktop-launch
Total time: 25.282s

Removed gnome-system-monitor snap and installed the deb gnome-system-monitor

$ time gnome-system-monitor

real 0m7.078s
user 0m1.507s
sys 0m0.256s

1 Like

Gnome logs snap

$ snap run --trace-exec gnome-logs

Slowest 10 exec calls during snap run:
0.333s snap-update-ns
0.457s /usr/lib/snapd/snap-confine
0.209s /snap/gnome-logs/81/snap/command-chain/snapcraft-runner
0.243s /snap/gnome-logs/81/gnome-platform/usr/bin/gtk-update-icon-cache
0.767s /snap/gnome-logs/81/gnome-platform/usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules
1.281s /snap/gnome-logs/81/gnome-platform/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
0.194s /snap/gnome-logs/81/gnome-platform/usr/bin/gtk-update-icon-cache
0.215s /snap/gnome-logs/81/gnome-platform/usr/sbin/update-icon-caches
0.804s /snap/gnome-logs/81/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0
4.950s /snap/gnome-logs/81/bin/desktop-launch
Total time: 18.911s

Removed gnome-logs snap and installed the deb one.

$ time gnome-logs

real 0m3.386s
user 0m0.962s
sys 0m0.109s
================================

Gnome Characters snap

$ snap run --trace-exec gnome-characters
Gjs-Message: 23:01:15.517: JS LOG: Characters Application started

(org.gnome.Characters:3687): GnomeDesktop-WARNING **: 23:01:38.541: Failed to load XKB rules file /usr/share/X11/xkb/rules/evdev.xml: Failed to open file ā€œ/usr/share/X11/xkb/rules/evdev.xmlā€: No such file or directory
Gjs-Message: 23:01:55.093: JS LOG: Characters Application exiting
Slowest 10 exec calls during snap run:
0.269s snap-update-ns
0.370s /usr/lib/snapd/snap-confine
0.146s /snap/gnome-characters/317/gnome-platform/usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules
0.303s /snap/gnome-characters/317/gnome-platform/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
0.143s /snap/gnome-characters/317/gnome-platform/usr/sbin/update-icon-caches
0.137s /snap/gnome-characters/317/gnome-platform/usr/sbin/update-icon-caches
0.189s /snap/gnome-characters/317/gnome-platform/usr/bin/gtk-update-icon-cache
0.243s /snap/gnome-characters/317/gnome-platform/usr/sbin/update-icon-caches
0.217s /snap/gnome-characters/317/gnome-platform/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0
3.491s /snap/gnome-characters/317/bin/desktop-launch
Total time: 45.354s

Removed gnome-characters snap and installed the deb one.

$ time gnome-characters
Gjs-Message: 23:05:03.439: JS LOG: Characters Application started
Gjs-Message: 23:05:10.886: JS LOG: Characters Application exiting

real 0m8.123s
user 0m5.678s
sys 0m0.170s

Well?
Snaps are slow to start, because they take a longer path?

You should make clear whether these are times for first snap launches after boot or not.

Try it yourself to find out. Thatā€™s the best way to test.

Yeah, ok, good luck.

1 Like

Chromium snap

$ snap run --trace-exec chromium
Gtk-Message: 21:16:33.373: Failed to load module ā€œcanberra-gtk-moduleā€
Gtk-Message: 21:16:33.463: Failed to load module ā€œcanberra-gtk-moduleā€
[2727:2897:1008/211636.183693:ERROR:token_service_table.cc(140)] Failed to decrypt token for service AccountId-102562585832489293610
[2869:2869:1008/211637.607402:ERROR:sandbox_linux.cc(369)] InitializeSandbox() called with multiple threads in process gpu-process.
[2869:2869:1008/211641.021952:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: ā† error from previous GL command
Slowest 10 exec calls during snap run:
0.593s snap-update-ns
1.130s /usr/lib/snapd/snap-confine
1.472s /snap/chromium/861/bin/desktop-launch
0.214s /usr/bin/dbus-send
0.235s /snap/chromium/861/bin/chromium.launcher
0.278s /usr/bin/dbus-send
0.361s /usr/bin/xdg-settings
20.135s /proc/self/exe
28.398s /snap/chromium/861/usr/lib/chromium-browser/chrome
20.416s /proc/self/exe
Total time: 31.631s

Didnā€™t uninstall Chromium snap, as all web browsers are self contained, but just brought the app folder out to Home.

~$ time ~/chromium-browser/chrome
[5072:5072:1008/212843.785778:ERROR:sandbox_linux.cc(369)] InitializeSandbox() called with multiple threads in process gpu-process.
[5072:5072:1008/212844.165025:ERROR:buffer_manager.cc(488)] [.DisplayCompositor]GL ERROR :GL_INVALID_OPERATION : glBufferData: ā† error from previous GL command

real 0m5.087s
user 0m6.032s
sys 0m1.318s

Well?
Does snaps boot snappily?

(There was an interesting thread on the snappiness, once. And, nothing came out of this one.)

Firefox snap

$ sudo snap install firefox

$ snap run --trace-exec firefox

A whole lot of errors in between, and finally,

Slowest 10 exec calls during snap run:
0.683s /usr/lib/snapd/snap-confine
0.764s /snap/firefox/271/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
3.304s /snap/firefox/271/usr/bin/gtk-update-icon-cache-3.0
3.316s /snap/firefox/271/usr/sbin/update-icon-caches
0.725s /snap/firefox/271/usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0
10.579s /snap/firefox/271/bin/desktop-launch
15.804s /snap/firefox/271/firefox-bin
18.119s /snap/firefox/271/firefox-bin
18.817s /snap/firefox/271/firefox-bin
13.472s /snap/firefox/271/firefox-bin
Total time: 73.486s

Total time 73.486s!

Removed the Firefox snap.

$ time firefox

###!!! [Parent][DispatchAsyncMessage] Error: PBackgroundIDBFactory::Msg_PBackgroundIDBFactoryRequestConstructor Value error: message was deserialized, but contained an illegal value

real 0m9.206s
user 0m14.867s
sys 0m2.648s

Any insights? @popey

See

And

And if you search the snap forum you will find more discussions on that topic, not sure it needs to be duplicated here againā€¦

A user needs/thinks that an app would start immediately when the user clicks on it. The time to go for cup of tea, until an app starts had gone forever, or so I thought. The 21 year old Apt is still doing better than the newer technologies.

Regarding Chromium, I just put it in the home directory and created a desktop file and a symlink. A web browser is, anyway a self contained folder. Or, it can be put in /usr/lib and desktop file in /usr/share/applications to get an icon on the menu/panel. Can be done both ways, though.

again, feel free to post this on the snap forum where the people maintaining snap packages, the developers of snapd and the whole infrastructure read along ā€¦

posting it here wont go anywhere beyond becoming a whining thread, if you want to help improving the situation (which i assume you do, since you invested some time to collect the numbers above) the right place to post is in https://forum.snapcraft.io

2 Likes

Ubuntu comes with few default snap apps, and they are much slower than their corresponding debs. This is about Ubuntu and Ubuntu apps, not about snapcraft. I put in the testing results for reflection.

Iā€™ve read the most interesting statement there ā€œStarting with snaps is easyā€ by two MS employees. I can understand their keenness.

Maybe, Iā€™d post the numbers at snapcraft forums too.

The correct forum is snapcraft - the observations are applicable to all snap enabled systems & distroā€™s.

There is little point in continuing the discussion here - this thread should be closed.

2 Likes

I think itā€™s fair to post here or the snapcraft forum. Given some of these are applications the Ubuntu Desktop team are responsible for. If thereā€™s specific issues identified, then we should hunt down where the bugs are and fix them if we can. The problem with the ā€œsnap is slowā€ argument is that itā€™s not as clear cut as that. The stack of things happening when you snap run firefox has some differences from the stack run when you /usr/bin/firefox.

We have made some changes in various places, but thereā€™s clearly still a problem, so thanks for bringing it up. We need to do more work to identify the specific parts that have bottlenecks and fix them, for sure.

Iā€™m not dismissing the issue, merely pointing out itā€™s actually super complicated. Thereā€™s a lot of moving parts, with possible issues covering a number of skills and domains.

4 Likes

I understand it is complicated and hope youā€™d succeed in overcoming them. I checked the Firefox snap out of curiosity. :slight_smile:

The interest is in Ubuntu, not other distros or systems. I donā€™t believe Archers using snaps, but these snaps may trouble other Ubuntu flavours, but it is still Ubuntu.

They do. Snaps are installed and used by users of basically every mainstream distro. Go here and scroll down to see a sample list of distros.

1 Like

I think itā€™d be best not to mention snaps in Arch forums. Anyway, this is off topic. :slight_smile:

@popey
I never had a real reason to look at other distros with Gnome shell before. Earlier Ubuntu had a DE no one had.
Anyway, checking standalone apps, such as Chromium, that I took out of the Chromium snap in Fedora 31 beta. I just copied the whole folder chromium-browser there and ran,

$ time ~/chromium-browser/chrome

The result,

real 0m4.541s
user 0m3.058s
sys 0m1.146s

In Ubuntu it was,

real 0m5.087s
user 0m6.032s
sys 0m1.318s

Just took the folder and put in Fedora 31 Beta. That folder is ~1/3 of the size of the Chromium snap in terms of MBs (607.3 MB snap, to 237.2 MB) . Just as portable!

Fedora installs Chromium browser normally, and the strange thing is it started slower than the one I took there.

$ time chromium-browser

gave,

real 0m14.429s
user 0m12.534s
sys 0m2.190s

Note: Of course, I can take the whole folder /usr/lib64/chromium-browser and place it anywhere and click on the executive file, and Chromium would start, also placed in Ubuntu. That one is also quite portable.

Yada Yada :sleeping:

1 Like

It is sickness, being a Yes man @francisco-ibanez-rioā€¦

Take it anyway you like it.

Firefox is contained in a folder, making it a portable app. Lives in /usr/lib/firefox
Libreoffice is contained in /usr/lib/libreoffice,


And, many more apps are just as portable. They donā€™t really have to be made portable, another way.