npub1de…nthv4 on Nostr: It doesn't use C++ but LLVM, which is a library for making compilers is written in ...
It doesn't use C++ but LLVM, which is a library for making compilers is written in C++. But your point stands to a degree - it uses the same optimizer as a C++ compiler (clang). That doesn't mean it'll be automatically equally fast, it also depends on what IR you feed into LLVM. Now the interesting thing is Rust inputs IR that is in some rare occurrences worse but in many other it's better, so overall people tend to find their code equal or slightly faster.
And the cool thing is that the worse part can be affected by the programner. If you profile your code and find a problem there you can fix it.
Zig is not another take on C++, but C and it doesn't really beat Rust. Because you have complete control over Rust code you can modify it to produce exactly the same machine code Zig would. It might be possible Zig is a bit faster by default but it is also much harder to write correct programs in.
Zig doesn't try to address memory vulnerabilities at all. Rust was proven to prevent all memory bugs if you don't use any unsafe code (clearly marked with unsafe keyword) or if you prove your unsafe code to be sound.
And the cool thing is that the worse part can be affected by the programner. If you profile your code and find a problem there you can fix it.
Zig is not another take on C++, but C and it doesn't really beat Rust. Because you have complete control over Rust code you can modify it to produce exactly the same machine code Zig would. It might be possible Zig is a bit faster by default but it is also much harder to write correct programs in.
Zig doesn't try to address memory vulnerabilities at all. Rust was proven to prevent all memory bugs if you don't use any unsafe code (clearly marked with unsafe keyword) or if you prove your unsafe code to be sound.