Towards Understanding the Runtime Performance of Rust

Towards Understanding the Runtime Performance of Rust
复制标题

理解 Rust 的运行时性能

DOI:
10.1145/3551349.3559494
复制
发表时间:
2023
期刊:
Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering
影响因子:
--
通讯作者:
Xu, Jun
Xu, Jun
中科院分区:
--
文献类型:
--
作者:
Zhang, Yuchen;Zhang, Yunhang;Portokalidis, Georgios;Xu, Jun

文献摘要

参考文献

被引文献

相似文献

Rust是一种年轻的系统编程语言,但由于其对内存安全的保证,它已经获得了巨大的普及。然而,Rust的性能还没有得到系统的了解,尽管许多人声称Rust在效率方面与C/C++相当。在本文中,我们的目标是以C为基准来了解Rust的性能。首先,我们收集了一组微基准测试,其中每个程序都使用Rust和C实现。为了确保公平性,我们手动验证Rust版本和C版本使用相同的算法实现相同的功能。我们基于微基准测试的测量表明,Rust通常比C慢,但不同程序的速度有所不同。平均而言,Rust带来的“性能开销”是C的1.77倍。其次,我们剖析了开销的根本原因,并揭示了它主要是由编译器插入的运行时检查和语言设计强制执行的限制引起的。由于禁用了运行时检查,限制也放松了,Rust的性能与C没有区别。
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.
DOI: --
发表时间: 2020
期刊: --
影响因子: --
作者:
Vikram Narayanan;Tianjiao Huang;David Detweiler;Daniel M. Appel;Zhaofeng Li;Gerd Zellweger;A. Burtsev
通讯作者: Vikram Narayanan;Tianjiao Huang;David Detweiler;Daniel M. Appel;Zhaofeng Li;Gerd Zellweger;A. Burtsev