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++.
翻译:Rust是一种较新的系统编程语言,在过去10年中被迅速采用。Rust在编译时采用了记忆所有权模式。由于这个模式涉及零运行时的管理管理费,Rust撰写的程序不仅能保证记忆安全,而且速度很快,其性能可与C和C+++相比。将Rust与其他语言的性能进行比较的多种现有基准侧重于很少使用的表面算法,从而得出一些没有结论的结果。在这项工作中,我们使用常用的算法和数据结构,而不是外来的算法和数据结构,对Rust和C++进行比较性能基准。我们的评估表明,Rust的总体性能与C++相似,只有很小的劣势。我们还表明,在某些Rust的常规中,Rust的性能略快于C+++的常规。