How much Rust in Firefox?
4e6.github.io
4e6.github.io
(First real public commit in gecko-dev is the historic open sourcing of the engine in 1998!)
https://github.com/mozilla/gecko-dev/commit/3b56a9af51519d2e...
Has anyone tried to build that commit in modern days? Would be interesting to see how it runs and how little the existing web would work with it. Maybe HN would load, but most other sites wouldn't. Since TLS wasn't defined until 1999, I'm guessing you would have to run a HTTPS->HTTP proxy first, as HTTPS wouldn't work.
I was almost tempted to try, but I think I'd rather sleep tonight instead.
FWIW, neither[1][2] crashes the current Safari for iOS (15.4).
[1] https://4e6.github.io/firefox-lang-stats/ [2] https://github.com/mozilla/gecko-dev/commit/3b56a9af51519d2e...
The obviously best choice is ".cc": your finger is already on the "c". But IDEs have led people to care less about ergonomic code organization.
It took me a minute to parse your post, so I restated it.
I agree that 20% seems quite a big larger, especially in a large multi-million LOC codebase like Firefox.
As an example, Java is in there for Android. There is also a lot of JavaScript that isn’t shared between desktop and Android.
The one other place I know of (other than android stuff) where java is used is the html parser (tokenizer really), which is written in java and then used to generate a C++ version.
mozilla-central only contains GeckoView (the embedding API for Android) which uses Java for the API itself and Kotlin for all the unit tests.
Being in a different repository, it didn't show up in OP's stats, either.
Dang, this is making me a little nostalgic. I actually really enjoyed writing Java Applets. I'm sure if I went back to some of my old codebases though I'd be thanking my lucky stars for React and LiveView.
I wonder how much of that ASM is for JIT compilation, and how much is for stuff like fast media decoding.
But according to the OG author of Rust, the elevator firmware where he lived crashed often, so: "I'd been sad about software and thinking of doing a language for a while, but "elevator can't even go" just seemed so pathetic.". Hence Rust was born. See https://twitter.com/graydon_pub/status/1492634815748739077 and https://news.ycombinator.com/item?id=30321747
The actual JS JIT will produce platform specific low level code, but it's not really written in asm (other than some minor snippets maybe), so it doesn't really show up in such LoC stats. The engine itself is mostly C++, but if I remember correctly some Rust too in specific places (like a wasm compiler).
https://infogulch.github.io/firefox-lang-stats/
It's very rough but it's a good PoC. Note that you can zoom in by selecting a time span. It looks like there are some discontinuities, but I think they are caused by a combination of the somewhat arbitrary one-commit-per-week selection, combined with merging between multiple root commits (firefox and servo it seems), and this repo being derived from a hg. I suppose a different commit selection query would alleviate this.
I created a separate generic lang-stats repo template ( https://github.com/infogulch/lang-stats ) that I hope could be used to easily generate and maintain a chart like this for any repo, after it's been polished up a bit.
You can do in 500 lines of rust what might take 5000 lines of C.
I would be interested to see this as a stack chart showing overall LoC.
Edit: Sorry if this was stupid question.
Plus it's closer to 20% of all systems language Firefox code is Rust (see other discussion itt).
What we can say is that both C++ and Rust can be much more concise, much more readable, and much less less prone to trivial mistakes than C or C-like C++.
https://docs.google.com/spreadsheets/d/1flUGg6Ut4bjtyWdyH_9e...
But in essence things have not changed dramatically in some months, so far as I know there are no current Firefox pushes to land big pieces of new Rust, or to Oxidise large pieces of Firefox.