Amazon.co.uk Widgets

Firefox is distributed as a snap now on Ubuntu.

Lets have a look at Firefox in Ubuntu 22.04 LTS. Things have changed. There is some trading of benefits for performance.

"Performance is the difference between feeling like you are clicking a button or just tapping a pane of glass".

Starting with Ubuntu 21.10, the default browser, Firefox transitioned to being distributed as a snap. The benefits are confinement in the snap sandbox, authentic updates directly from Mozilla and support for any snapd equipped distribution.

The trade-offs are in performance, due to the sandboxing inherent in the snap architecture. Browser perfomance is something of a bogeyman for Firefox so this would appear to be a high priority for both organisations.

Screenshot:About Firefox Browser on Ubuntu 22.04 LTS
About Firefox Browser on Ubuntu 22.04 LTS.

What drove the decision to make Firefox a snap?

Speaking from experience, I have been irritated in the past that Firefox was pretty much always outdated on Ubuntu compared to other platforms. Anything that could improve that is welcome. I need to use Firefox on macOS, as well as Linux and its helpful to keep them in sync both with Firefox sync and the same Firefox version. Ubuntu say:

"This decision was made in collaboration with Mozilla based on the quality of life improvements that snap delivers:
  • Confinement: snaps add an extra security layer on top of the browser’s already-robust sandboxing mechanism. The browser sandbox protects the browser against malicious code, whilst the snap confinement protects the user from the browser acting in ways that it shouldn’t.
  • Effortless updates: browsers receive frequent updates and, with the snap, users are able to receive security patches from Mozilla more quickly than with other software distribution methods.
  • Authenticity: Whilst Canonical builds the snap, it is published and maintained by Mozilla. This is Firefox straight from the source, directly to users, without the overhead of keeping build dependencies up to date.
  • Cross-release compatibility: If your distro runs snapd, it can run the Firefox snap, from Ubuntu to the official flavours and beyond. It also means that older releases get the latest updates without additional maintenance."

What they don't say here, but is implied, is that there were trade-offs. The main one being performance, and there is also a fair amount of anti-snap noise online to contend with.

Defining "Performance"

Ubuntu have set out three specific areas for perfornance concern:

  • Cold start performance: The time taken when Firefox is started for the first time after a system restart.
  • Warm start performance: Firefox startup on subsequent runs. A lot faster due to cache.
  • Runtime performance: Active usage of Firefox.

Ubuntu's current focus is on the cold start performance following a similar approach to work on the Chromium snap to isolate the root causes. Their blog goes into a lot of detail about how to measure this, and encourages participation through their discourse based comment system. (See the links below).

Snap criticisms

Some Linux people don't like Snap. Reasons vary from it being controlled by Canonical, the creator of Ubuntu, to it being opaque due to the somewhat proprietary nature of the Snap Store, to it offending other distribution creators and to it competing with other technologues like AppImage and FlatPak. Im old enough to remember there being only 'rpm' but of course in Ubuntu there has always been 'apt'. This whole arena of app management on Linux continues to be messy.

By way of comparison, on macOS there is a secure proprietary operating system volume, a separate data volume and an app store for apps which have been signed and approved by Apple. These technologies had their own critics on introduction and now. If you need more Unix like tools for macOS theres 'Homebrew' for all the things you might need that Apple don't or won't provide. Nowadays on macOS, Homebrew is pretty much a standard for developers or technical people. On Linux things are more chaotic. Snap, which came out of the trash fire that was the Ubuntu phone project, largely succeeds in providing a modern sandboxed mechanism for app delivery and this should be applauded.

It is my feeling that new users of Linux desktop probably dont want to watch an installer compile all their tools, let alone deal with the complexities required to be able to do so. Importantly, they can do this, as can seasoned Linux users, if they want to, but Snap solves the depencency mess that often used to be the frustrating Linux experience when trying to do something simple like install an app. Ubuntu is more appealing to new users because of Snap, and that has to be a good thing.

So while the criticisim of Canonical and snap is noted, it still gets my approval, such as it is.

Runtime performance

With the release of Firefox 100.0 Ubuntu enabled Profile-guided optimization (PGO), a capability that Firefox has had since 2013, and Link Time Optimization (LTO) a compiler flag available since 2009. This, Ubuntu claim, delivers significant improvements to runtime performance as well as some impact on startup times. There is more to be done, they say, hinting at further runtime performance improvements.

Runtime performance benchmarks

So I thought it would be interesting to capture my assessment of the runtime performance, using my ThinkPd X230, which is a decade old and an 8GB machine running an Ivy Bridge i5-3210M processor at 2.50GHz with integrated Intel HD Graphics 4000. I long ago added an SSD as the main storage which delivered a new lease of life to this computer and it is a favourite of mine.

I ran three popular benchmark suites and here are the results: This is with Mozilla Firefix 100 (64-bit) Snap for Ubuntu canonical-002 1.0. Interestingly with the 100.0.2 update the tests showed two improvements and one slight decrease. As more updates are tested I will at least be able to see if theres a meaningful difference on this machine.

Mozilla Firefox 100.0 (64-bit) Snap for Ununtu canonical-002 1.0

# Benchmark Score
1 JetStream2 47232
2 MotionMark 1.2 91.36
3 speedometer 54.5

Mozilla Firefox 100.0.2 (64-bit) Snap for Ununtu canonical-002 1.0

# Benchmark Score
1 JetStream2 51110
2 MotionMark 1.2 93.30
3 speedometer 54.1

JetStream2

This is a JavaScript and WebAssembly benchmark suite focused on the mst advanced web apps. It rewards browsers thar start up quickly, executte code quickly and run smoothly.

MotionMark 1.2

MotionMark is a graphics benchmark that measures a browser’s capability to animate complex scenes at a target frame rate.

speedometer

Speedometer tests a browser's Web app responsiveness by timing simulated user interactions.


In conclusion then, on my ancient laptop I can run the latest version of Firefox, without wondering about dependencies, and it seems as snappy as it does on my brand new Mac. That is really something! I can take this indestructable ThinkPad anywhere I need and dont have to worry about it getting pinched or broken. And importantly I dont have to worry about it being outdated. Im reluctant to take a more expensive computer out on a commute or to a meeting these days.


See also:
How Ubuntu are improving Firefox snap performance? Part 1. 
Known issues with Firefox Snap. 
In Linux Mint 20, APT will forbid snapd from getting installed. 
Canonical’s Snap: The Good, the Bad and the Ugly. 
Browser benchmarks 
ThinkPad X series