4 ms·
Just as quickly as it replaced C/C++ in Firefox?
by rob74 5y ago
Just as quickly as it replaced C/C++ in Firefox?
- zozbot234 5y agoFirefox is getting new "oxidized" component all the time, Rust is the recommended language for both refactoring and new development. Of course the lowest-hanging fruits are addressed first, but that's normal and advisable.
- pjmlp 5y agoNot after they let go everyone related to Rust, as far as I am aware. Hence the crazy idea of now using WebAssembly in Firefox modules instead.
- steveklabnik 5y agoThat's not correct. Firefox continues to gain new Rust code. Compare https://web.archive.org/web/20201109025230/https://4e6.github.io/firefox-lang-stats/ https://web.archive.org/web/20201109025230/https://4e6.githu..., the first version of this page archive.org saved after the layoffs. 9.5% Rust, 2.9 million LOC. Today https://4e6.github.io/firefox-lang-stats/ https://4e6.github.io/firefox-lang-stats/ 10.1% Rust, 3.4 million LOC.
- pjmlp 5y ago10% in a browser currently having 3% market share with a decreasing tendency towards 0%. Most of that code is surely related to what was replaced initially instead of new subsystems being ported.
- steveklabnik 5y ago> 10% in a browser currently having 3% market share with a decreasing tendency towards 0%. Irrelevant to the question of how much Rust is in Firefox. > is surely Okay, it's clear you're not going to change your mind, no matter what.
- tialaramex 5y agoThere's a big difference between "We don't employ the language's architects" (so far as I'm aware Mozilla also doesn't employ many WG21 members) and "We don't have any engineers who know this language". In 2022 you'd probably have to go out of your way to hire that many engineers and not get some people who know Rust. Not to mention how much less experience you need in Rust to not blow everybody's feet off by mistake. I reckon if you have 10 years C++ and six months Rust, any Rust you write is already more likely to deliver reasonable performance without setting everything on fire than your C++. Because of the constant exposure to outright malevolent stinking garbage (in the form of other people's HTML, CSS and Javascript) the browser needs to be exceptionally robust, and C++ just isn't very good for that. So Rust is often a better fit for what Mozilla do.
- pjmlp 5y agoYet Chrome and Safari, the browsers that really matter in 2022, won't be moving away from C++. Chrome folks have been playing with Rust, but seem more keen in improving their C++ static analysis tooling instead. As for Mozilla, it is 10% of Rust code and lets see for how long Firefox still matters, given the existing 3% market, even EdgeChrome has surpassed it.
- tialaramex 5y ago> Chrome folks have been playing with Rust, but seem more keen in improving their C++ static analysis tooling instead. I would say that at this point that's good money after bad. Linus of course also put a bunch of effort into static analysis, that's what "sparse" is. The thing you run into immediately is that your programming language doesn't express the thing you wanted to analyse very well. So you have to annotate your software (Linux is sprinkled with sparse annotations), and now you've added an extra opportunity for mistakes, because the annotations are transparent to the compiler, so you can write code which analyses as correct but compiles to something incorrect. "Hooray".
- npigrounet 5y ago
- dralley 5y agoPlease don't spout nonsense. They did not let go of "everyone related to Rust", large parts of Firefox are written in Rust and those parts obviously need to be maintained. New Rust code continues to be written, as others have pointed out. What Mozilla did do was lay off many of the people working on Rust itself as their full-time job, as opposed to people who use Rust to do their work at Mozilla. And the Servo team, unfortunately.
- pjmlp 5y agoHence why I mentioned "as far as I am aware" instead of stating is a fact. The 10% as pointed out in a sibling comment, while admirable isn't large parts.
- dralley 5y agoIt's more than it sounds like. As you can see from the breakdown someone posted [0], almost two-thirds of the Firefox codebase is HTML / JavaScript / Python (for tests) / assembly / Java (for Android), none of which is a candidate for being rewritten in Rust to begin with. If you just look at the portion written in native system languages, Rust is slightly more than 1/3 of that code already and still climbing. [0] https://4e6.github.io/firefox-lang-stats/ https://4e6.github.io/firefox-lang-stats/
- devmunchies 5y agoI'm new to programming, whats Firefox?