4 ms·
You could imagine that, but would be foolish to. Rust is not denser than C++.
by ncmncm 5y ago
You could imagine that, but would be foolish to. Rust is not denser than C++.
- klysm 5y agoDo you have any numerical evidence for that? I would suspect it is slightly denser.
- ncmncm 5y agoIn my experiments from a few years ago, they were exactly even, in both size and speed. Those experiments were far from comprehensive, and both languages have changed since, but not really much. The differences between coding styles of different people are generally much larger than any difference I could imagine showing up in real programs. 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++.
- Barrin92 5y agoWhile it's true that you can write very terse modern c++ my guess is that a lot of c++ code in the firefox codebase is quite old and it would surprise me if it's not closer to plain C in verbosity. Which definitely isn't as compact as Rust.
- ncmncm 5y agoTrue, modern C++ is usually quite a lot more compact than older styles, and than C and might-as-well-be-C.
- alkonaut 5y agoThe language density isn't everything. The biggest benefit of Rust over C++ is the module/package system. if you can replace a 50 line utility with a crate (1 line of toml) that makes a big difference. You'd rarely add a library dependency in C++ to use a small utility function.