Amazon Deals
Computers

Firefox 54 Finally Supports Multithreading, May Beat Chrome on RAM Usage

After eight years of work, Mozilla just took the wraps off its multi-threaded rendering engine and declared it ready for the general public to use. The new Firefox 54 is capable of using multiple threads simultaneously — a major step forward for the browser. In a new Medium post, Mozilla’s Ryan Pollack discusses how the multithreaded engine works and what advantages and differences Mozilla brings to the table compared with Google Chrome.

The post is written to be easily understood, and starts off by explaining the difference between a process (the instance of a program being executed) and a thread (generally defined as the smallest sequence of programmed instructions that can be managed independently by a scheduler).

Process-and-Threads

Years ago, Mozilla made a fateful decision about the future of Firefox development — one that made it much more difficult to integrate multiprocessing into the existing browser. Roughly 10 years ago, the major way Firefox had distinguished itself compared with Internet Explorer was through its support for add-ons and extensions. But the same add-on abilities that had made the browser popular also made it difficult to add multiprocessor support. Mozilla therefore committed to transitioning away from its old add-on model and towards multi-browser web extension support, while simultaneously launching the Electrolysis project to create a new browser version that could support a multi-processing architecture.

Last year, the company launched the first phase of Electrolysis, by splitting its UI and its web page content to run in two different processes. With the release of Firefox 54, Mozilla has completed its transition to a multithreaded uarch.

What sets Firefox apart

Chrome and Firefox now both support multithreading, but they do it in different ways. In Chrome, each and every tab you open gets its own content process. Ten tabs, 10 processes. One hundred tabs, 100 processes. This approach maximizes performance, but you pay a hefty penalty in memory consumption and (when applicable) battery life. Firefox doesn’t take this approach to the problem, but instead spins up to four content process threads by default.

“[Y]our first 4 tabs each use those 4 processes,” Pollack writes, “And additional tabs run using threads within those processes. Multiple tabs within a process share the browser engine that already exists in memory, instead of each creating their own.”

FF-vs-Chrome

Chrome uses a separate content process and engine for each website instance,
but Firefox reuses processes and engines to limit memory usage.

Mozilla claims that Firefox also uses dramatically less memory than other competing browsers, with Chrome using 1.77x more RAM than Firefox in 64-bit and 2.44x in 32-bit mode. The differences were less dramatic in Mac OS X and Linux (1.36x and 1.42x, respectively). According to the team, Firefox leads in every category. RAM usage isn’t a battery life issue — memory consumes about the same amount of power whether you are storing data in it or not, provided that you aren’t running some kind of page-hammering benchmark. But having more RAM available does mean a better, smoother experience when juggling a lot of open tabs while running other programs.

Going forward, Mozilla is launching a new initiative, dubbed Project Quantum, to focus on optimizing the browser engine that runs within a content process. Pollack notes that the new project will use Rust, a system programming language Mozilla sponsors. Pollack writes:

As part of the project, Mozilla engineers are using Rust to code super-fast parallel algorithms that would be incredibly difficult to code safely with C++. With these algorithms, major pieces of Firefox’s engine (e.g. CSS styling), will run in parallel across multiple CPU cores, instead of sequentially on one core. Also as part of Quantum, Firefox will utilize threads to focus computing power and your network connection on the tabs you’re actively using. Firefox will get much faster, while still being respectful of your memory and your needs.

Could this be the beginning of a resurgent Firefox? We’ll have to wait and see. Chrome has eaten most of the browser market in the US, but people once thought that IE represented an unstoppable juggernaut with an iron grip on the market thanks to Microsoft’s ownership of the PC space. If that kind of upset can happen once, it could certainly happen again.

Let’s block ads! (Why?)

ExtremeTechComputing – ExtremeTech

Click to comment

You must be logged in to post a comment Login

Leave a Reply

To Top
Social Media Auto Publish Powered By : XYZScripts.com