Two common complaints about snaps are their size and their startup time. These are causally linked: larger snaps start a lot slower because there is more to decompress and there is more to keep the dynamic linker busy.
Adding an easy way for developers to reduce their snap size is really useful, so I started work on a
cleanup extension. This extension can be used by snap authors to remove all the libraries from their snap which are already available from the base snap and connected content snaps. Thanks @diddledani for the excellent post-build cleanup part.
With this extension I was able to reduce the
mc-installer snap size from 104MB to 39MB and its cold startup time from 5 seconds to 1 second.
What I need help with
- The extension needs to run after all other extensions because it needs to know which content snaps will be connected, even if those content snaps are added by other extensions. How can I achieve this?
- The extension needs access to the expanded
snapcraft.yamldefinition so it can see what plugs the other extensions have added. What’s the best way to do this? Do we just give all extension access to the expanded manifest?
I created a rough PoC in the PR to get a discussion started.