Mozilla has enlisted the help of Samsung to create a new browser engine that takes advantage of multicore processors. It seems that Gecko might not have a long-term future.

Things in the browser world suddenly seem a lot less stable than they were - but progress is always good? As well as Google and Opera splitting off from WebKit to develop their own multicore optimized version (Browser Split - Google And Opera Fork WebKit To Blink), Mozilla has announced a collaboration with Samsung, the Servo Parallel Browser Project, to develop its own multicore engine.

As Mozilla CTO Brendan Eich puts it in his blog:

"Servo is an attempt to rebuild the Web browser from the ground up on modern hardware, rethinking old assumptions along the way. This means addressing the causes of security vulnerabilities while designing a platform that can fully utilize the performance of tomorrow’s massively parallel hardware to enable new and richer experiences on the Web. To those ends, Servo is written in Rust, a new, safe systems language developed by Mozilla along with a growing community of enthusiasts."

If you were wondering why Mozilla was dabbling with language design then the reason for Rust now becomes much clearer. Rust is a language that has enhanced multi-tasking compared to languages such as C but it still compiles to native code, which in principle means it should be as fast. Mozilla's current rendering engine, Gecko is written in C and, even though switching to Rust makes sense, it is still a big gamble. To build a new programming language just because you need to write a new rendering engine could be regarded as extreme.

Samsung's part in the whole deal seems to be to bring its knowledge of the ARM processor to Rust and Servo, and in particular getting things working on Android. What does Samsung get out of it? Yet more control over Android, perhaps, or an alternative mobile operating system ready to dilute Google's control?

Mozilla has more at stake here than just Firefox running on mobile phones. Firefox OS is a blend of the Firefox browser with Linux designed to operate as the native environment on low-end mobile phones. That is, the user interface and apps that run on Firefox OS are HTML5 apps using JavaScript. Even low-end phones will, in the near future, have more cores than they know what to do with and hence one way to increase the performance of Firefox OS is to make the layout engine multi-task. This would also make it a more attractive OS for high end phones and tablets where even more cores are waiting to be put to work.

Key in all of this is the Rust language used to implement Servo. It has just reached version 0.6 and, with a major project like Servo under its belt, now looks a lot more like an interesting language than it did before.

To quote Eich again:

"Rust, which today reached v0.6, has been in development for several years and is rapidly approaching stability. It is intended to fill many of the same niches that C++ has over the past decades, with efficient high-level, multi-paradigm abstractions, and offers precise control over hardware resources. But beyond that, it is *safe by default*, preventing entire classes of memory management errors that lead to crashes and security vulnerabilities. Rust also features lightweight concurrency primitives that make it easy for programmers to leverage the power of the many CPU cores available on current and future computing platforms."

However, if you think that Gecko's days are numbered, then it is worth pointing out that things are slightly more tentative than you might think:

"In the coming year, we are racing to complete the first major revision of Rust – cleaning up, expanding and documenting the libraries, building out our tools to improve the user experience, and beefing up performance. At the same time, we will be putting more resources into Servo, trying to prove that we can build a fast web browser with pervasive parallelism, and in a safe, fun language. We, along with our friends at Samsung will be increasingly looking at opportunities on mobile platforms. Both of these efforts are still early stage projects and there’s a lot to do yet, so now is a good time to get involved."

This does seem to be very much a research project at the moment, but implementing a multicore rendering engine seems like the right thing to do and not an impossible task. Taking the "invent a language" route is perhaps taking the Domain Specific Language idea a step too far, but it will be interesting to see how it all turns out.

I for one will certainly give Rust a deeper look in the near future - so look out for an article describing what I find out.