Is Rust C++-fast? Benchmarking System Languages on Everyday Routines (2024)

[Submitted on 19 Sep 2022]

View PDF

Abstract:Rust is a relatively new system programming language that has been experiencing a rapid adoption in the past 10 years. Rust incorporates a memory ownership model enforced at a compile time. Since this model involves zero runtime overhead, programs written in Rust are not only memory-safe but also fast, leading to performance comparable to C and C++. Multiple existing benchmarks comparing the performance of Rust with other languages focus on rarely used superficial algorithms, leading to somewhat inconclusive results. In this work, we conduct a comparative performance benchmark of Rust and C++ using commonly used algorithms and data structures rather than exotic ones. Our evaluation shows that the overall performance of Rust is similar to C++, with only minor disadvantage. We also demonstrate that in some Rust routines are slightly faster than the ones of C++.
Comments: Michigan State University
Subjects: Programming Languages (cs.PL); Performance (cs.PF)
Cite as: arXiv:2209.09127 [cs.PL]
(or arXiv:2209.09127v1 [cs.PL] for this version)
https://doi.org/10.48550/arXiv.2209.09127

arXiv-issued DOI via DataCite

Submission history

From: Nikolay Ivanov [view email]
[v1] Mon, 19 Sep 2022 15:45:50 UTC (1,663 KB)

Is Rust C++-fast? Benchmarking System Languages on Everyday Routines (2024)

FAQs

Is Rust C++-fast? Benchmarking System Languages on Everyday Routines? ›

Rust's performance is comparable to C++ in everyday routines, showing minor disadvantages but also instances where Rust is slightly faster, as per the benchmark conducted in the research paper.

Is Rust just as fast as C++? ›

As a descendant of C and with its compiled code, C++ is superior to languages such as Python, C#, or any other interpreted languages. When comparing, Rust performance vs C++ is often cited as being faster because of its unique components.

Is Rust a high performance language? ›

Rust is a mature memory-safe programming language with little/no compromise on performance. It is as efficient as C/C++ and almost free of memory-related errors.

Is Rust faster than Python? ›

Speed. Rust's performance translates into faster execution speeds than Python, especially for CPU-bound tasks. Python's interpreted nature introduces overhead, making it slower in comparison, particularly for performance-critical applications.

Is Rust a slow language? ›

So yes, Rust is slow if you use it in a way that it wasn't designed for. You can still make it fast by doing those optimizations yourself, but here you're explicitly restricting yourself to not do them.

Why use Rust instead of C++? ›

Rust is a multiparadigm, compiled programming language that developers can view as a modern version of C and C++. It is a statically and strongly typed functional language. Rust uses syntax similar to C++ and provides safety-first principles to ensure programmers write stable and extendable, asynchronous code.

Is Rust a C++ killer? ›

The C++ Killers (Not You, Rust) | Hacker News. [Languages like Rust] do help you to write more features with fewer bugs, but they are not of much help when you need to squeeze the very last flop from the hardware you rent. I do think that Rust helps you squeeze out that last 1% of performance over C++.

Why is Rust a bad language? ›

Rust isn't particularly good at correctness of programs compared to something like Agda, but it is much easier to write Rust programs than Agda programs. The sides of the tradeoff are problem domain complexity, runtime cost, programmer effort, and compile-time cost.

Is Rust losing popularity? ›

While Rust's community is growing at an incredible pace, its adoption in the industry is not far behind. Tech giants like Microsoft, Google, and Amazon have recognized Rust's potential and are actively supporting it. As a result, Rust is increasingly finding its way into real-world applications and products.

Why is Rust not popular? ›

Rust is extremely powerful but has a higher initial barrier to entry than most languages due to its type system and ownership model (affine types).

Is Rust going to replace Python? ›

Rust will not replace Python because it is faster. More Python libraries will be written in rust maybe, like polars or ruff, which is totally fine. But they will be called using Python because it is simpler and faster to code. That's why numpy is also so popular.

Is Rust more difficult than C++? ›

Rust is widely considered easier to learn than C++. C++ is notoriously difficult, with experienced and senior developers turning to it for the most part. Meanwhile, Rust is thought to have a low learning curve.

What is the salary of Rust developer? ›

Average Rust developer salary in India – ₹4,355,206 ($58,069) a year or ₹362,934 ($4893) a month. Average Rust developer salary in the USA – $153, 063 a year or $12,755 a month.

Why is Rust so difficult? ›

Most of what makes Rust relatively hard is that the compiler is less forgiving of errors than other programming languages, so that a program that Rust accepts is more likely to be correct than a program that simply compiles/runs written in another language.

Is Rust more low level than C++? ›

Low-level programming is possible in Rust, as it is in many high-level languages, but it is discouraged. Use of "unsafe" is rightfully met with scepticism. C++ is also a high level language, but does not enforce use of high-level safety abstractions by default.

What language does Rust replace? ›

Rust will quickly replace C in the kernel, I have no doubt about it. Hacker News.

Does Rust compile faster than C++? ›

For full builds, C++ will take longer to compile than Rust (i.e. Rust wins). This is because of C++'s #include feature and C++ templates, which need to be compiled once per . cpp file. This compilation is done in parallel, but parallelism is imperfect.

Is Rust easier to use than C++? ›

Ease of use

Most people who use both Rust and C++ say that Rust is easier to use due to its well-defined semantics and its ability to prevent unwanted/undefined behavior. Similarly, C++ has so many features that it can be challenging to keep track.

Is Rust more productive than C++? ›

Echoing the past two years of Rust evangelism and C/C++ ennui, Google reports that Rust shines in production, to the point that its developers are twice as productive using the language compared to C++.

Is Rust a good C++ replacement? ›

Both the programming languages have their own pros and cons like C++ has huge community support and many frameworks for software development but rust doesn't have that much support in comparison to C++.

Top Articles
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5795

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.