|
|
Subscribe / Log in / New account

multi-language code base

multi-language code base

Posted Feb 5, 2025 6:58 UTC (Wed) by Trainninny (guest, #175745)
In reply to: multi-language code base by tialaramex
Parent article: Resistance to Rust abstractions for DMA mapping

Is it true that there is less than 350K LOC of non-vendored Rust in Firefox, and more than 5000K LOC of C++? I do not know how much of third_party/ is vendored.

If it is true, then Rust would have less than 10% LOC of the C++ code.


to post comments

multi-language code base

Posted Feb 5, 2025 11:32 UTC (Wed) by excors (subscriber, #95769) [Link] (2 responses)

It appears many of the `third_party/rust` libraries are developed largely by Mozilla. That includes `encoding_rs` (cloc says 130K lines, though it's almost all auto-generated data tables so don't put too much trust in cloc), all the `wgpu` ones (140K lines), `neqo` (60K lines), etc. Mozilla is also a significant part of WebAssembly (110K across several crates), etc.

So "third_party" doesn't mean they're developed by third parties - it seems more like a sign that a library's primary home is outside the gecko-dev repository, which includes Mozilla-developed ones that are designed to be usable by non-Mozilla projects too. (Many of them are implementing web standards, so there's a good chance others will find them useful). Mozilla periodically imports them into gecko-dev and often applies some local patches, presumably to fit in with Mozilla's stability requirements and release cycle; they'll submit fixes upstream too, but I guess they don't want to wait for upstream to apply the fix and then risk regressions by pulling the latest upstream release, hence the vendoring and patching.

multi-language code base

Posted Feb 5, 2025 17:52 UTC (Wed) by Trainninny (guest, #175745) [Link] (1 responses)

Thank you, I am not very familiar with Firefox's source code, and I did not figure out a way to easily and quickly differentiate between the different dependencies in third_party/ .

I believe the example libraries of Mozilla Rust code that you mention that are focused on the browser, could be fair to include those as Firefox Rust code. So a ballpark figure of how many Rust LOC that Firefox has, could maybe be 600K LOC of Rust in third_party/, making the ballpark figure of Rust in Firefox 1000K LOC, which is about 20% of C++ LOC in Firefox. A substantial amount, if my ballpark figure is not way off.

multi-language code base

Posted Feb 7, 2025 12:31 UTC (Fri) by taladar (subscriber, #68407) [Link]

A large reason why C++ is all first party is probably also because C++ tooling to create separate libraries is so incredibly painful to use that it incentivizes people not bother unless they have a very good reason to do so, leading to much worse code reuse than the language itself could support.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds