Hacker News new | past | comments | ask | show | jobs | submit login

> With the work they are doing rewriting Firefox component by component in Rust, Google will have their work cut out keeping up in terms of performance using their C++ implementation.

I would expect Blink’s C++ implementation to perform comparably; wouldn’t the main benefits would be security-related?




No, it is very hard to take a complex rendering engine written in C++ and make it multithreaded, secure, and thread safe (i.e. correct).

In theory you could do this in C++ of course but in practice, both Google and Mozilla have struggled with this for many years and both have still some major bottlenecks in their browser rendering pipeline that are effectively still single threaded and can end up blocking the main thread.

This the main reason Rust was invented (by Mozilla) and they've delivered a few component rewrites that leverage e.g. multiple cores. They've been shipping this bit by bit for the last two years (since the quantum release) and they're not done yet. E.g with the latest releases they've started to ship the new web render on some hardware/os combinations.

Faster is a simplistic notion that is hard to quantify but having a more smooth loading page, with less visible stuttering, and higher frame-rates for animation is sort of the main goal here. People also care about memory usage, energy drain on laptops, etc. If you look at all of this then it used to be the case that people went from Firefox to Chrome to improve the experience and you now have people moving the other way.


Mozilla tried to parallelize their CSS engine multiple times in C++, and failed. Rust’s guarantees made it possible to do so. There was a talk about it at a Rust conference called “The Story of Stylo”; I’m on my phone or I’d link you.


Following my curiosity, I found:

The Story of Stylo: Replacing Firefox's CSS engine with Rust

https://www.youtube.com/watch?v=Y6SSTRr2mFU

Woo, 9M lines of C/C++ to 85K lines of Rust..

Author's slides: https://www.joshmatthews.net/rbr17/


No, for the style system is 160K lines of C++ down to 85K lines of Rust. Still a great win!


Those numbers sound much more realistic, ~53% reduction in code size - and you're right, it's a great testament to Rust's conciseness!


Stability also improves when you have less bugs. And you get less memory leaks, what it a big worry for browsers.

But no, I do disagree. Rust is more expressive than C++ and much easier to debug. I expect the new Gecko development to be easier and faster than Chromium, what leads to more features.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: