Fearless Concurrency in Firefox Quantum

Jack Smith
Jack Smith

These days, Rust is used for all kinds of things. But its founding application was Servo, an experimental browser engine.
Now, after years of effort, a major part of Servo is shipping in production: Mozilla is releasing Firefox Quantum!
Rust code began shipping in Firefox earlier this year, starting with relatively small pilot projects like an MP4 metadata parser to replace some uses of libstagefright. These components performed well and caused effectively no crashes, but browser development had yet to see large benefits from the full power Rust could offer. This changes today.

Stylo: a parallel CSS engine
Firefox Quantum includes Stylo, a pure-Rust CSS engine that makes full use of Rust’s “Fearless Concurrency” to speed up page styling. It’s the first major component of Servo to be integrated with Firefox, and is a major milestone for Servo, Firefox, and Rust. It replaces approximately 160,000 lines of C++ with 85,000 lines of Rust.
When a browser is loading a web page, it looks at the CSS and parses the rules. It then determines which rules apply to which elements and their precedence, and “cascades” these down the DOM tree, computing the final style for each element. Styling is a top-down process: you need to know the style of a parent to calculate the styles of its children, but the styles of its children can be calculated independently thereafter.
This top-down structure is ripe for parallelism; however, since styling is a complex process, it’s hard to get right. Mozilla made two previous attempts to parallelize its style system in C++, and both of them failed. But Rust’s fearless concurrency has made parallelism practical! We use rayon —one of the hundreds of crates Servo uses from Rust’s ecosystem — to drive a work-stealing cascade algorithm. You can read more about that in Lin Clark’s post. Parallelism leads to a lot of performance improvements, including a 30% page load speedup for Amazon’s homepage.

Wrapping up
Overall, Firefox Quantum benefits significantly from Stylo, and thus from Rust. Not only does it speed up page load, but it also speeds up interaction times since styling information can be recalculated much faster, making the entire experience smoother.
But Stylo is only the beginning. There are two major Rust integrations getting close to the end of the pipeline. One is integrating Webrender into Firefox; Webrender heavily uses the GPU to speed up rendering. Another is Pathfinder, a project that offloads font rendering to the GPU. And beyond those, there remains Servo’s parallel layout and DOM work, which are continuing to grow and improve. Firefox has a very bright future ahead.
As a Rust team member, I’m really happy to see Rust being successfully used in production to such great effect! As a Servo and Stylo developer, I’m grateful to the tools Rust gave us to be able to pull this off, and I’m happy to see a large component of Servo finally make its way to users!
Experience the benefits of Rust yourself — try out Firefox Quantum!

Read the full article:
https://blog.rust-lang.org/2017/11/14/Fearless-Concurrency-In-Firefox-Quantum.html

All urls found in this thread:
https://blog.rust-lang.org/2017/11/14/Fearless-Concurrency-In-Firefox-Quantum.html
https://hacks.mozilla.org/2017/11/entering-the-quantum-era-how-firefox-got-fast-again-and-where-its-going-to-get-faster/
https://github.com/tokio-rs/tokio
https://crates.io/crates/mio
https://tokio.rs/
https://en.wikipedia.org/wiki/Enigform
https://gnunet.org/gns
https://github.com/rust-lang/rfcs/pull/2033
Brandon Jones
Brandon Jones

Is parallelism really this hard in other languages, especially C++? Or are the pozzilla devs just shit?

James Peterson
James Peterson

(checked)
Short answer: Yes
Long answer: You're a nodev LARPing as a dev so you wouldn't know what it is like working on a big codebase.

Kevin King
Kevin King

Watch out who're calling a nodev, i wrote hello world in C!

Tyler Nelson
Tyler Nelson

Styllo doesn't work properly with standard stuff like bootstrap and materialise, so, fuck off

Brody Clark
Brody Clark

They're just shit. You can easily make a nightmarish mess out of concurrency if you don't know what you're doing but there are plenty of modern design patterns to stay safe. The only time it gets really sketchy is when doing kernel work where only relatively high-risk primitives are available and are used dangerously for performance and the extreme code churn of the kernel can lead to a successful merge that changes which primitive is covering your code. It's why companies are so reluctant to change kernel versions and instead pay for almost every major kernel release to be maintained 'stable' these days.

Jeremiah Green
Jeremiah Green

wrong

design patterns
gtfo pajeet

Parker Jackson
Parker Jackson

FF 52, Chrome, and Quantum

Julian Campbell
Julian Campbell

(checked)
well maybe firefox 52 and chrome are fucked up. can you provide the source please?

John Cooper
John Cooper

<div class="container valign-wrapper" style="min-height: 60vh">
<div class="section">
<div class="row">
<div class="col s12 m4 center">
<img src="HTTPS_padlock.png" style="width: 20vw;" />
</div>
<div class="col s12 m8">
<p class="light">
The technology behind the modern internet is fundamentally insecure. The backbone of <b>half a billion</b>
websites, <b>SSL</b>, now known as <b>TLS</b>, is broken. TLS is the protocol behind <b>HTTPS</b>, which
keeps your transactions with your bank, <i>BitPay</i>, and even your logins to <i>Google</i>
secure - or at least, that's the idea. The current model, however, does not appear to be working.
<br><br>
A world where <b>200,000</b> of the top million sites have poorly implemented HTTPS is not acceptable. The
consequences from having one's usernames and passwords stolen can be far-reaching, catastrophic, and
hard to deal with. And if those details are financial, even one's <b>wealth</b> can become at risk.
<br><br>
The first rule of security is that of keeping the number of
participants as low as possible - TLS adds a third, always looming, <b>in total control</b>
over proving you're talking to who you think you are. These are <b>Certificate Authorities</b> - A
centralised cartel of secretive bureaucratic corporations, issuing the documentation you need for safe
browsing, and they have shown time and time again they cannot be trusted.
</p>
</div>
</div>
</div>
</div>

Hudson Hall
Hudson Hall

Yeah. Quantum gets it right. Rust wins again.

Jonathan Ramirez
Jonathan Ramirez

Seriously it's even the same fucking few pictures.

Angel James
Angel James

btw this is how it looks on firefox developer edition 58.0b3

John Baker
John Baker

btw: Keeping financial transactions and web browsing secure: Introducing Aguris, a game-changing cryptocurrency.
LOOOOOOOOOOOL. kill ypurself cryptokike

Jose Edwards
Jose Edwards

I take it they've updated since I last used it, so fair enough.

Anthony Baker
Anthony Baker

The technology behind the modern internet is fundamentally insecure. The backbone of half a billion websites, SSL, now known as TLS, is broken.
Polygora issues TLS certificates
So what they are saying is that their shit is broken by design?

Jace Cox
Jace Cox

Gotta make money somehow. Let's Encrypt is great and all, but centralised cancer. Crypto-Decentralism is the future.

(Until some sort of DNS level encryption is developed.)

The plan is to use blockchain technology to implement a distributed certificate authority. That way, CAs can't kike you. Let's Encrypt is great but centralised, and will eventually run out of money.

Levi Gomez
Levi Gomez

So how is this better than self signed certificates?

Evan Stewart
Evan Stewart

Self-signed certs are only useful if you know you can trust the self-signed cert. They're not useful on the open web.

Chase Robinson
Chase Robinson

So how do I know that I can trust your decentralized cryptokike certificates?

Levi Richardson
Levi Richardson

The same way you can trust LE's, they'll be DV certs requiring proof you control the server. Look up ACME

Joshua Morgan
Joshua Morgan

But how do I know that I can trust the cryptokike cryptocurrency?
It really seems like a meme that is never going to take off tbh.

Gavin Green
Gavin Green

i use an older laptop it runs hot and firefox consistently crashes around 75c - 90c. often kernel panic occurs and i'm forced to restart. this happens reliably, as in guaranteed, when firefox is running and the computer reaches these temps.

running qupzilla, this never happens.
note that firefox uses rust, qupzilla is c++ :)
a lot of things are fucked with firefox but this is some real pajeet-tier bullshit firefox is pulling.

Colton Williams
Colton Williams

and i'll add qupzilla performs flawlessly even when temps reach 100c and the cpu throttles.

Angel Gutierrez
Angel Gutierrez

I don't know what you mean. It's cryptocurrency, there's no need for trust.If something is wrong it won't be cryptographically verifiable

Bentley Mitchell
Bentley Mitchell

LOL. You are just adding lots of shit which increases the attack surface but it is ok because crypto. Have you actually verified that their crypto isn't fucked? Have you verified that the implementation of their shit isn't fucked?

Luis Reed
Luis Reed

parallelism is one of the hardest things to do correctly. Specially since there are lots of ways to do fast code that breaks, and lots of ways to do slower (even single threaded) that don't.

That being said... Its not the hardest problem. Nor the most important one.

Even if rust did parallelism correctly and "fearlessly' (which I doubt, given the rust constricts and forces you to bend backwards to play it safe already) Its not worth the sintactic nightmare nor the ugly, narcisistic cult that tries to convince you its the best language ever.

They are just silly people that wasted their time in something short lived.

They make me think on the " the king come down" creepy pasta. Theyre just helpless fools trapped in some shitty mind curse, trying to shit other people minds. They're unable to hold conversations and they will dismiss everything you say to them, appearing all shining and clean on the next thread as if they had not received a severe beatdown decomposing their beliefs.

Brayden Howard
Brayden Howard

bla
bla
bla
muh rust
bla
bla
i wrote hello world in c once and it didn't segfault XDDD
bla

epic post bro

Kayden Roberts
Kayden Roberts

Meant to answer

Youre still a fucking cult.

Ryder Baker
Ryder Baker

They can capitalize the first Letters of random Nouns all they want, I'm not adopting it if I can't use my Add-ons.

Dominic Anderson
Dominic Anderson

Gotta admit, he found a great way to market his cryptobubble.

Hudson Watson
Hudson Watson

OMG FIREFOX QUANTUM IS SO FAST IM USING IT RIGHT NOW ANDS ITS BLAZING FAST OMG OMG
RUST IS THE BESTEST!111!

Daniel Baker
Daniel Baker

let's see it.

Lucas Wilson
Lucas Wilson

Sticking with Chromium eh?

Nolan Perez
Nolan Perez

It isn't so much that C++ is harder, but that Rust is faster, uses less memory, needs less code and takes less time to develop.

Henry Roberts
Henry Roberts

It's not that fast.

Seamonkey and Palemoon remains faster as for loading and memory impact.

the rest depends of your internet access.

Also, Quantum is a buzzword that don't mean jack shit in anything but particle physics.

Isaiah Roberts
Isaiah Roberts

They better not fuck this up, Firefox can't render more than a few dozen box shadows before it shits the bed.

Adrian Roberts
Adrian Roberts

Samefag.

Cameron Jenkins
Cameron Jenkins

Firefox not slow as shit anymore
gets rid of the one thing it had going for itself (add-ons) in the very same version
Fucking genius!
Not I can choose between a bloated, slow piece of shit with functionality or a bloated, slightly faster piece of shit without any functionality. What a time to be alive!

Mason Nguyen
Mason Nguyen

https://hacks.mozilla.org/2017/11/entering-the-quantum-era-how-firefox-got-fast-again-and-where-its-going-to-get-faster/
The Firefox Quantum story is actually inspiring.

Owen Hill
Owen Hill

using unmaintained addons
retard

Gavin Long
Gavin Long

inspiring
That's code for made up bullshit about one-armed quadriplegic non-binary muslim trans-lesbians of color finding a safe space to build clocks, I mean, to "program", right?

Cameron Peterson
Cameron Peterson

Many add-ons cannot or will not be updated to the new, shitty and restrictive system.

Parker Peterson
Parker Peterson

Also, moon is a buzzword that doesn't mean jack shit in anything but spaceflight

Benjamin Lewis
Benjamin Lewis

Short answer Wrong.
Long Answer: If your threat model includes pervasive mass surveillance from a passive attacker, unauthenticated encryption can provide confidentiality without integrity. (But provides no protection from an active MITM)

Jack Davis
Jack Davis

I honestly don't have a problem with rust. It's not C, but not every language needs to be. I do, however, have issues with groups that adopt SJW codes of conduct. Granted, it's not like they can stop you from writing shit in rust even if you don't follow it, but it still worries me.

Hunter Jenkins
Hunter Jenkins

Pictures in blue
Cancer

Connor Bennett
Connor Bennett

(Until some sort of DNS level encryption is developed.)
Is DNScrypt not what you are looking for?

Nicholas Cook
Nicholas Cook

Rust is faster
Bullshit.
uses less memory
Bullshit.
needs less code
Maybe the only valid point.
and takes less time to develop.
Fucking bullshit. Nobody can write 1 line of Rust code without thinking for 3 minutes beforehand.

Carson Rodriguez
Carson Rodriguez

Fucking bullshit. Nobody can write 1 line of Rust code without thinking for 3 minutes beforehand.
This is a good thing.

Aiden Long
Aiden Long

No it isn't, you mongoloid. In other programming languages, you think about how to solve the problem. In Rust, you think about how to get the arcane syntax for the statement you want correct.

Adrian Jackson
Adrian Jackson

So in rust you have think about:
a) how to solve the problem
b) how to express your solution in rust
whereas in other languages you think about:
a) how to solve the problem
b) how to express your solution in rust

Truly a world of differences

Sebastian White
Sebastian White

Stop putting words in my mouth, you know exactly what I meant. Rust syntax is so complex and the stdlib is so fucked up that writing a single line of code takes minutes. Plus they said they will never support shit like epoll so it's useless for sockets.

Ayden Jenkins
Ayden Jenkins

rust is too complicated for me :(

Jackson Diaz
Jackson Diaz

useless for sockets
https://github.com/tokio-rs/tokio

Jaxon King
Jaxon King

These days, Rust is used for all kinds of things.
stopped reading right there.
lies

Tyler Jenkins
Tyler Jenkins

Did you even look at the references under "rust friends"

Asher White
Asher White

Rust syntax is so complex
You are just too retarded to understand abrilliant language. Maybe you should take a look at Go?
the stdlib is so fucked up that writing a single line of code takes minutes
What?????? How is the std fucked up? How is the std at fault when you can't grok Rust's syntax?
Plus they said they will never support shit like epoll so it's useless for sockets.
Bullshit. We never said that we will never add async io into the std. take a look at those projects:
https://crates.io/crates/mio
Mio is a lightweight I/O library for Rust with a focus on adding as little overhead as possible over the OS abstractions.
https://tokio.rs/
A platform for writing fast networking code with Rust.

Jayden Wilson
Jayden Wilson

firefox
sudo apt-get install etherape
Enjoy the botnet.
Install icecat.
rust
Cult thread

Is the volunteer paid to let these threads a thing ?
820044
needing parallelism to render text and images
820045
You need to get back to your cult.
Let's Encrypt is great and all, but centralised cancer.
Can't say it isn't.
Crypto-Decentralism is the future.
https://en.wikipedia.org/wiki/Enigform
(Until some sort of DNS level encryption is developed.)
https://gnunet.org/gns

Tyler Cooper
Tyler Cooper

Just switched to FF 57, and it seems slower than current Waterfox release.
On the other hand, everything is slow as fuck for me now, maybe it's related to running laptop with removed battery, which could maybe limit peak CPU speed or something. So maybe it's not FF at fault.

Ryan Morgan
Ryan Morgan

Is the volunteer paid to let these threads a thing ?
yes, all volunteers on 8ch are corrupt and get bribes for deleting some stuff and not deleting other stuff. Holla Forums is not any different

Hudson Morris
Hudson Morris

Without coroutine support on language level, this stuff is cumbersome.
This is why everybody sticks with Python unless high speed byte crunching at application level is also needed.
Until Rust Stable doesn't have coroutines, it pretty much loses to Python in this regard.

Sebastian Flores
Sebastian Flores

https://github.com/rust-lang/rfcs/pull/2033

Disable AdBlock to view this page

Disable AdBlock to view this page