TY - GEN
T1 - Towards Understanding the Runtime Performance of Rust
AU - Zhang, Yuchen
AU - Zhang, Yunhang
AU - Portokalidis, Georgios
AU - Xu, Jun
N1 - Publisher Copyright:
© 2022 Owner/Author.
PY - 2022/9/19
Y1 - 2022/9/19
N2 - Rust is a young systems programming language, but it has gained tremendous popularity thanks to its assurance of memory safety. However, the performance of Rust has been less systematically understood, although many people are claiming that Rust is comparable to C/C++ regarding efficiency. In this paper, we aim to understand the performance of Rust, using C as the baseline. First, we collect a set of micro benchmarks where each program is implemented with both Rust and C. To ensure fairness, we manually validate that the Rust version and the C version implement the identical functionality using the same algorithm. Our measurement based on the micro benchmarks shows that Rust is in general slower than C, but the extent of the slowdown varies across different programs. On average, Rust brings a 1.77x "performance overhead"compared to C. Second, we dissect the root causes of the overhead and unveil that it is primarily incurred by run-time checks inserted by the compiler and restrictions enforced by the language design. With the run-time checks disabled and the restrictions loosened, Rust presents a performance indistinguishable from C.
AB - Rust is a young systems programming language, but it has gained tremendous popularity thanks to its assurance of memory safety. However, the performance of Rust has been less systematically understood, although many people are claiming that Rust is comparable to C/C++ regarding efficiency. In this paper, we aim to understand the performance of Rust, using C as the baseline. First, we collect a set of micro benchmarks where each program is implemented with both Rust and C. To ensure fairness, we manually validate that the Rust version and the C version implement the identical functionality using the same algorithm. Our measurement based on the micro benchmarks shows that Rust is in general slower than C, but the extent of the slowdown varies across different programs. On average, Rust brings a 1.77x "performance overhead"compared to C. Second, we dissect the root causes of the overhead and unveil that it is primarily incurred by run-time checks inserted by the compiler and restrictions enforced by the language design. With the run-time checks disabled and the restrictions loosened, Rust presents a performance indistinguishable from C.
UR - http://www.scopus.com/inward/record.url?scp=85146920398&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85146920398&partnerID=8YFLogxK
U2 - 10.1145/3551349.3559494
DO - 10.1145/3551349.3559494
M3 - Conference contribution
AN - SCOPUS:85146920398
T3 - ACM International Conference Proceeding Series
BT - 37th IEEE/ACM International Conference on Automated Software Engineering, ASE 2022
A2 - Aehnelt, Mario
A2 - Kirste, Thomas
T2 - 37th IEEE/ACM International Conference on Automated Software Engineering, ASE 2022
Y2 - 10 October 2022 through 14 October 2022
ER -