+ 4
Which is better Rust or C++? [CLOSED]
I've been researching about secure way to code and with a good performance. I found various articles on web saying Rust out performs C++ in performance and is also secure as it has different functions for safe and unsafe handling. My main concern is let's say I do FFT on a very large dataset or in an easier way to put it is a very heavy maths calculation and it also deals with graphics. So I'm not sure about how exactly can I do that comparison as I don't know Rust yet. Hence, I wanted some guidance on which language to choose. Please ask additional questions if you need clearance as I'm not sure in myself how exactly to describe my issue.
8 odpowiedzi
+ 2
depending on what operations you intend to use, Rust might be or not be what you want. Being younger than C++, it does not have the large ecosystem of the latter.
searching for "Rust fft and graphics" gave me this link
https://www.youtube.com/watch?v=P4i2HhJoxeI
+ 1
C++ cuz I think it has more use cases 🤔(I could be very wrong)
+ 1
Snehil Pandey, From what I have researched, I have come to the following conclusion:
• The best performance of Rust and C++ is almost identical, as both can generate equally optimal assembly if, and only if, the programmer writes efficient code and the compiler optimises well.
• However, C++ is much older than Rust and has years of appropriately tuned libraries, compilers ( like GCC or Clang) and industry use and shows excellent performance for mature domains like FFT, graphics, and linear algebra, because the best(?) implementations are pre-existent (e.g., FFTW, Intel MKL, CUDA etc. libraries).
• Rust, on the other hand, is newer as compaired to C++ and lacks the same highly optimised libraries for domains like heavy numerical computing or GPU programming.
• Rust is said to be more safe and reliable although C++ gives better and more complete control.
+ 1
Bob_Li thanks for your answer
And after understanding the video it seems a bit related to what I'll be performing
But the thing is can it be performed on c++ as easily as it done on rust cause I've not image processing knowledge on c++
Thanks for your answer I'll do the next part on my own.
Now I think I've got a clear point of what stuffs are needed
0
Snehil Pandey
Also, as Bob_Li said, C++ has a vast ecosystem for numerics (FFTW, BLAS, LAPACK, CUDA, OpenCL, SYCL), graphics (OpenGL, Vulkan, DirectX wrappers, Unreal/Unity engines), and scientific computing which are optimised, and ready-to-use. These have still not been outperformed by Rust.
I should say that, if performance is the absolute top priority, you might want to use C++. And, if safety and maintainability is what ypu want, then Rust will probably be what you need.
Thank you.
0
Adding this as an after-thought:
C++ is a bit more difficult to master as compared to Rust. And to yeild the best performance using C++, one has to code very carefully making sure no bugs remain (C++ is also a bit difficult to debug).
0
Ushasi Bhattacharya the very first answer I find it very much influencing.
As what I need as a whole is fast processing, secure practices to be there in my case
But still I believed regardless of online articles that c++ is superior
Thanks for your information and about debugging and stuffs I do acknowledge that c++ is hard but not to that extent.
I still have a vast topics to explore on c++ but based on my requirement I guess that I have some knowledge
But the issue here isn't about knowledge rather a secure code with fast processing
And yeah I'm greatly convinced to use c++ cause I find Rust a bit weird to learn (I mean it's quite difficult for me who started with cpp, c or java; same happened in python at the start)
Thanks for your detailed answer
0
I think CPP i don't know Rust can be good but i like CPP there are so many reasons for this and already Ushasi write there all those things