3 ms·
I think you may have misunderstood my comment, as I did not mean to disparage Rust's speed nor imply it was slower than C/C++. Rust, at best, can match C/C++. B
by ComputerGuru 10y ago
I think you may have misunderstood my comment, as I did not mean to disparage Rust's speed nor imply it was slower than C/C++. Rust, at best, can match C/C++. But Rust cannot be faster than C/C++; therefore, by function of simply being rewritten in rust (and not because it was rewritten), that does not, in and of itself, make the resulting executables faster.
- steveklabnik 10y agoRust _can_ be faster than C or C++. The possibility is different than always, though.
- saosebastiao 10y agoThere is no proof that any existing C/C++ implementation can produce code that is globally optimal. I wouldn't say that it is impossible for Rust to beat C/C++...there is plenty of room for improvement in compiler optimization engines. I would even say that the room for improvement is potentially greater for rust than it is for C/C++, due to the type system. It hasn't been taken advantage of much yet, but MIR is one of the first steps to do so. It's an intermediate stage representation, like llvm's IR, but with all type resolution intact. There are plenty of known and even formally proven code optimizations that can only be used if certain guarantees are proven (such as the guarantees made by a strong type system).