14 hours ago, moeen k said:
it seems that it outperformes c++ and is faster than c++. its managed like c#...
It seems like a contradiction to me. I don't know Rust, but c++ is not inherently fast. It is only fast if you use it properly. There are a lot of pitfalls that can slow a c++ program down. Maybe Rust has much less of these pitfalls because of this:
6 hours ago, Plotnus said:
Rust is more restrictive than other languages, hence it's "guarantees".
In conclusion, I guess the "average programmer dude" might generally be able to write faster code with Rust than with c++, because he is not allowed to mess around with stuff he barely understands.
On the other hand, an experienced programmer will use the extra control of c++ to his advantage and will probably generate faster code with C++.
14 hours ago, moeen k said:
has not problem of memory allocation and management and has efficient Garbage collection system.
Memory management is not a problem. It's actually a gift if you know how to utilize it to your advantage. If you don't know how to handle it, it might be a problem. However, using a garbage collection system is probably not what you want if you aim for maximum performance since it always comes with a management overhead. That's why I said that 'fast' and 'managed' seems like a contradiction to me.
In general, more control means, more pitfalls but also more possibilities. In the end, all that matters for performance is machine code (cache/memory issues neglected) and that depends on the capability of your compiler to translate C++/Rust into effective machine instructions. The language you use is only important in the context of how well you can explain to the compiler what you are intending to do. The better he knows what you want, the better he is capable of optimizing the code. Therefore, it needs to be precise and also rich enough to cover all possible problems. It's a little bit like ordering a pizza. If you want one with salami and extra mozzarella and you say 'cheese' because your language does not know the term 'mozzarella', you might end up getting gouda instead. ![;) ;)](https://uploads.gamedev.net/emoticons/wink.png)
To sum it up:
Since C++ is designed to be as close as possible to the hardware in a portable way (in contrast to assembly, which is hardware-specific), I doubt that Rust generally outperforms optimized c++. It might get equally fast with less verbose/complicated code but I am also not sure of that (garbage collection). I might be wrong. I don't know everything... YET! ?
Greetings