Debunking that C++ is faster and safer than Rust
1–10 of 84 posts
Re: Debunking that C++ is faster and safer than Rust
#2Re: Debunking that C++ is faster and safer than Rust
#3Re: Debunking that C++ is faster and safer than Rust
#4Anyway for a truth (well maybe it is a myth?) that we can't bust yet... Rust is simply not available on all platforms that C++ is. Two platforms that I think are missing:
* 16-bit MS-DOS
* 32-bit PowerPC (Linux)
Re: Debunking that C++ is faster and safer than Rust
#5Strictly speaking it's the compiler that generates faster code.
Re: Debunking that C++ is faster and safer than Rust
#6Re: Debunking that C++ is faster and safer than Rust
#7Be aware that this isn't a LLVM bug but a direct consequence of the insanity of C++ specification (wrt. forward progress induced undefined behaviour).
The C++ rules around forward progress allow C++ compilers to faster eliminate code which doesn't produce any observable side effects (without the code triggering undefined behaviour) but it also removes code which intentionally or not hangs the process in a busy loop or is intended to cause a stack overflow... (e.g. for testing protections).
The flag currently isn't added to rust as the penalty effect on compiler time (needs to run more analysis) and runtime (doesn't eliminate all code it should) is currently pretty high.
So this might take a while until _fully_ fixed (you always can pass in the flag yourself if you want).
Through some fixes which make it harder to hit the bug until a proper solution is found _might_ not be so far of (I hope).
Re: Debunking that C++ is faster and safer than Rust
#8> The bug has been present in LLVM since 2006. It's an important issue as you want to be able to mark infinite loops or recursions in such a way as to prevent LLVM from optimizing it down to nothing. Fortunately, things are improving. LLVM 6 was released with the intrinsic llvm.sideeffect added, and in 2019, rustc got the -Z insert-sideeffect flag, which adds llvm.sideeffect to infinite loops and recursions. Now infi…
Re: Debunking that C++ is faster and safer than Rust
#9> The bug has been present in LLVM since 2006. It's an important issue as you want to be able to mark infinite loops or recursions in such a way as to prevent LLVM from optimizing it down to nothing. Fortunately, things are improving. LLVM 6 was released with the intrinsic llvm.sideeffect added, and in 2019, rustc got the -Z insert-sideeffect flag, which adds llvm.sideeffect to infinite loops and recursions. Now infi…
Re: Debunking that C++ is faster and safer than Rust
#10Important to note that PVS-Studio is a static analysis tool for C++. As such it would definitely be in their interest to have more people use C++, but since they're arguing in favor of Rust here it definitely speaks to the fact that their analysis is unbiased.