Ubuntu cuts startup time of Snap-format Firefox by 50%
Ubuntu cuts startup time of Snap-format Firefox by 50%.
The Snap version of Firefox is the default Firefox wrapper for Ubuntu 22.04 LTS, and the Snap format improves security, provides cross-version compatibility, and reduces the time it takes for Mozilla to push changes.
The price of these benefits is that Firefox in Snap format has major performance issues and takes a long time to start, especially when starting Firefox for the first time after a system restart.
Canonical has been working on various improvements to address Firefox Snap’s launch time issues.
With the latest improvements pushed to Firefox Snap, Firefox Snap ‘s startup time has been reduced by approximately 50%.
This performance optimization mainly consists of two major improvements.
The first is about changes to how Firefox handles language packs, and the second is an update to the GNOME and GTK theme snapshots that Firefox relies on.
Extension Handling – Language Packs
Previously, Firefox copied all language packs on first launch, a huge and unnecessary overhead since most people run Firefox with only one UI language, such as Chinese, English, or French.
Mozilla’s latest fix causes Firefox to only load one language at a time (following system settings), which affects the time to start Firefox for the first time after installation, with tests showing an average reduction of about 6 seconds.
GNOME and GTK theme snapshot compression
Canonical has previously used LZO compression for Firefox snaps to improve Firefox startup performance. But what it doesn’t take into account is that the Firefox snap depends on the gnome-3-38-2004 and gtk-common-theme snaps, which are still delivered compressed using the XZ algorithm.
Since the Firefox snap loads libraries from both snaps during startup, the decompression process can create a performance bottleneck.
Switching the compression algorithm for both snapshots to LZO as well, further improved Firefox’s startup time.
Another benefit is that this change affects not only Firefox, but also the start time of all snapshots that depend on GNOME and GTK snapshots, including Chromium and Thunderbird.
In addition, according to media Phoronix , Canonical will next investigate multi-threaded decompression, solve the software rendering problem used by Firefox on the Raspberry Pi, and explore pre-caching. Learn more details about the latest Firefox Snap progress on the Ubuntu Blog .