6 ms·
"I'm not seeing much indication from the mailing list that safety-off all-go performance is a priority for the Rust devs" It is. We are counting every cycle in
by pcwalton 14y ago
"I'm not seeing much indication from the mailing list that safety-off all-go performance is a priority for the Rust devs"
It is. We are counting every cycle in the JS<->Rust bridge, for example, when compared against C++ Gecko and WebKit.
As a general policy, Mozilla does not take performance regressions. Servo is a total non-starter if it is a performance regression over the existing C++ browser engines.
That said, Rust does some things by default that C++ doesn't do by default, such as stack overflow checks and array bounds checks. This is because we believe that, for most apps, they're the right defaults when weighed against the dire security consequences. It's planned for both of these to be able to be switched off in the future. (It's already possible to switch off array bounds checks, and switching off stack growth will be needed for competitive JS<->Rust interoperability in Servo.)
- codewright 14y agoLets not commit the same sin as the PyPy people, is it really faster than the C++ rendering engine? If not, how far off the mark is it? I really want real numbers, not idle conjecture. Gosling was fond of speculating that Java would eventually be faster than C and C++ because of $COOL_FEATURE_X, but nothing ever materialized or made enough of a difference. Concurrent GC didn't make up the difference. JIT didn't make up the difference. Why would I believe anybody else bringing the same message? This cyclical "we're gunna be faster and here is the cool compiler research saying so!" is why the programming language community has thoroughly alienated my colleagues that work in systems. They can't afford to build their systems on speculation, it HAS to work. They believe nothing anybody says about programming languages now. What's the most impactful territory to conquer that could help make up the difference? Rust's design allows for a subset of valid programs that could be constructed in C++. It's the same kind of thinking that Haskell utilizes. The type system is useful in Haskell because it disallows potentially invalid programs giving you a smaller space to reason about. (cf. Total programming) However, that subsetting means avenues and opportunities for optimization are eliminated. Optimization sometimes means doing something batshit. A high-level 6502 emulator a friend wrote in x86 asm comes to mind.
- pcwalton 14y agoIt's currently slower, yes. Stack checks and stack switching, for example, are part of the reason; that's why we plan to make them able to be turned off. Certainly, if you need something to be shipped soon, and you need it to be performance-competitive with C++, don't use Rust. Despite the fact that it's backed with LLVM, the compiler is quite immature. I don't think at this point that any significant avenues for optimization are closed off in the Rust language design relative to C++. The safety checks are all designed to be optional.
- pron 14y agoGosling was fond of speculating that Java would eventually be faster than C and C++... but nothing ever materialized or made enough of a difference. Uhm, I'd say Java already is faster than C++ for all intents and purposes. If your codebase is >50KLOC and the number of developers on your team is more than, say, 4 or 5, then some crazy optimizations that are possible in C++ for small applications are out of the question, and the JIT plus the GC more than make up the remaining difference. Also, modern performance-critical software requires good concurrency, and Java has stuff like fork-join, that I'm not sure is available in standard C++ (it is, of course, available in Cilk). So, even though it's hard to provide hard evidence (because most benchmarks are <50KLOC and written by one or two developers at most), I'd say from experience that Java already is faster than C++ in practically all circumstances (except, maybe, scientific-computation applications), not counting startup time. The only missing piece in the Java performance puzzle is value types and arrays-of-structs, and those, I believe are coming, and should make scientific-computation faster in Java as well.
- codewright 14y agoI'll assume you're talking about throughput, rather than latency/real-time constraints. I'm pretty dubious, given that Google extensively utilizes C++ in their more performance sensitive portions of their architecture. Their custom web server, for example, is written in C++. Lets not forget the rather large HPC codebases out there in Fortran. Can you prove any of this?
- 14y ago