6 ms·
C is still the king in performance I believe. Linux still has assembly code apart from C for those crucial performant sections. Remember if you are talking at
by bitcoinmoney 9y ago
C is still the king in performance I believe. Linux still has assembly code apart from C for those crucial performant sections.
Remember if you are talking at the HW-level you don't have the luxury of libraries and I doubt Go/Rust would be of any help unless you build the ecosystem for it. Something like the implementation of coreutil binaries can benefit from Go/Rust but not the OS-code itself.
- steveklabnik 9y agoIf Rust is significantly slower than C, it's a bug.
- fooker 9y agoYeah, just one that will take a decade of compiler optimizations to solve. C and C++ didn't become what they are today overnight.
- steveklabnik 9y agoWe share an optimizer with clang thanks to LLVM; we get to take advantages of those decades already.
- fooker 9y agoClang and LLVM have evolved together for a while. It is pretty difficult to get similar results with other LLVM frontends. You don't have to believe me, just write a reasonably complicated algorithm (say.. a naive SAT solver) with both C++ and Rust (or Swift or $NEW_LANG) and compare the speeds.
- steveklabnik 9y agoYou don't have to believe me either; if you try it, you should generally see that they have the same performance.
- javajosh 9y agoWhen you say "naive SAT solver" do you mean one where you hard-code a boolean formula with N variables and then check every possible solution (from 0 to 2^N)? If so, does this kind of program accurately characterize the kind of work a kernel does?
- fooker 9y agoNo, something like the CDCL algorithm without domain specific heuristics and tweaks. I expect that is fairly representative in terms of ..say.. common data structures needed in most systems.
- fooker 9y agoHere are some fairly realistic examples. 1. Rust : http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gcc http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan... 2. Swift : http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=swift&lang2=gcc http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan... As for a SAT solver, I was not speaking out of my ass. Here is one try that got a fair bit of attention. https://github.com/mishun/minisat-rust https://github.com/mishun/minisat-rust
- steveklabnik 9y agoYeah, we've had some small regressions recently; a few months ago we were usually faster, now we're slightly slower. Still generally close, except for the ones that need explicit SIMD, as that's still being designed.