Canonical has begun addressing performance issues with the Firefox snap package that was offered by default in Ubuntu 22.04 instead of the regular deb package. The main user dissatisfaction is due to the very slow launch of Firefox. For example, on a Dell XPS 13 laptop, the first launch of Firefox after installation takes 7.6 seconds, on a Thinkpad X240 laptop it takes 15 seconds, and on a Raspberry Pi 400 board it takes 38 seconds. Restarts are completed in 0.86, 1.39 and 8.11 seconds, respectively.
During the analysis of the problem, 4 main reasons for the slow start were identified, the solution of which will be given the main attention:
- High overhead when searching for files inside a compressed squashfs image, which is especially noticeable on low-powered systems. The problem is planned to be solved through the grouping of content to minimize the movement operations in the image at startup time.
- On Raspberry Pi and systems with AMD GPUs, large delays were associated with a failure to detect the graphics driver and a fallback to using software rendering with very slow shader compilation. A patch to solve the problem has already been added to snapd.
- A lot of time was spent copying the add-ons built into the package into the user’s directory. There were 98 language packs built into the snap package, all of which were copied regardless of the chosen language.
- Delays also occurred due to the determination of all available fonts, icon themes, and font configurations.
Launching Firefox from a snap has also seen occasional runtime performance issues, but Ubuntu developers have already prepared fixes to improve performance. For example, starting with Firefox 100.0, link-in-time optimizations (LTO) and code-based profiling (PGO) optimizations are enabled in the build. To address messaging issues between Firefox and external subsystems, a new XDG Desktop Portal has been prepared and support is under review for inclusion in Firefox.
The reasons for promoting the snap format for browsers are the desire to simplify maintenance and unify development for different versions of Ubuntu – the deb package requires separate maintenance for all supported branches of Ubuntu and, accordingly, assembly and testing taking into account different versions of system components, and the snap package can be formed immediately for all branches of Ubuntu. Moreover, the Firefox snap package offered in Ubuntu is maintained by Mozilla employees, i.e. it is formed first-hand without intermediaries. The snap distribution also speeded up the delivery of new versions of the browser to Ubuntu users and made it possible to run Firefox in an isolated environment created using the AppArmor mechanism to further protect the rest of the system from exploiting vulnerabilities in the browser.