6 ms·
Is there some kind of target or plan for converting C/C++ to Rust in Firefox? Or is it just happening as there are people interested in working on parts of the
by pedrocr 8y ago
Is there some kind of target or plan for converting C/C++ to Rust in Firefox? Or is it just happening as there are people interested in working on parts of the stack?
These progress numbers are very interesting:
https://twitter.com/eroc/status/1061049330574884864 https://twitter.com/eroc/status/1061049330574884864
and I was wondering how directed the effort was.
- robin_reala 8y agoIt’s the Oxidation project: https://wiki.mozilla.org/Oxidation https://wiki.mozilla.org/Oxidation
- hsivonen 8y agoNot a specific target of having to replace C++ for the sake of replacing C++. The way Rust code gets added includes: * A new feature needs an identifiable library, so the new library can be written in Rust to begin with. (Example: U2F token USB integration.) * Old code needs a rewrite anyway, so the rewrite can be in Rust. (Example: Character encoding converters.) * Servo has proven a component, so it makes sense to bring it over. (Examples: Stylo and WebRender) * History of vulnerabilities in code that was replaced. (Example: MP4 metadata parser)
- Already__Taken 8y agoIs anyone aware of secondary effects this has had? e.g. removed C++ code that has later found to have bugs, or newly re-written crates now more useful to the wider community than the same code locked up in C++.
- hsivonen 8y ago> e.g. removed C++ code that has later found to have bugs The article links to a longer article (https://hsivonen.fi/encoding_rs/ https://hsivonen.fi/encoding_rs/) about encoding_rs. The longer article mentions a bug that got fixed in Firefox ESR after the code had been replaced with encoding_rs in non-ESR Firefox. (I wrote the bug, too, though.) > or newly re-written crates now more useful to the wider community than the same code locked up in C++. encoding_rs is an example of a crate developed for Firefox but also developed as a crates.io crate from the start. ripgrep is probably the best-known Rust-only app that uses encoding_rs. Since Visual Studio Code bundles ripgrep, I believe Microsoft shipped encoding_rs before Mozilla did!
- vtesucks 8y agoIn terms of deploying rust directly to make money- Microsoft is probably the leader right now with actix used in azure iot
- polskibus 8y agoDid you mean this actix? https://github.com/actix/actix https://github.com/actix/actix Is it mature? Can you shed more light on how is it used in production?
- steveklabnik 8y agoThey're referring to https://news.ycombinator.com/item?id=17433142 https://news.ycombinator.com/item?id=17433142 I don't believe that it uses Actix, though. Actix was created by and is maintained by a Microsoft employee.
- kannanvijayan 8y agoAs far as I know there is no overarching plan, but there are many people who do hold that motivation - some are more aggressive about their intent and others are more lax, and yet others are skeptical - as with any community of developers. The broad sentiment seems to me that it's a good thing to move over, as pragmatism allows. Personally I'm a converted skeptic - I had my doubts about the language and my initial stabs at it left me somewhat frustrated - but as I've grown to internalize its semantics and behaviour - the benefits in terms of safety and clarity of intent and optimization potential are clear (e.g. aliasing semantics are just so much better). A mix of factors enter into whether a component moves over or not, including the views of the developer in question, the complexity of the API boundary between the main codebase and the subcomponent, and the complexity of the component logic itself.