Is Rust faster than Fortran and C++? A case study with scientific applications.

471 points Xdudou 92 comments

Hi everyone! 👋

Over the past year, I’ve been working on something interesting: We’ve ported the NAS Parallel Benchmarks (NPB) to Rust.

If you're not familiar with NPB, it's a widely used benchmark suite originally developed in Fortran by NASA’s Numerical Aerodynamic Simulation Program, to compare languages and frameworks for parallelism.

The NPB-Rust allow us to compare Rust's performance against languages like Fortran and C++ using complex scientific applications derived from physics and computational fluid dynamics as benchmarks.

The results show that Rust’s sequential version is 1.23% slower than Fortran and 5.59% faster than C++, while Rust with Rayon was slower than both Fortran and C++ with OpenMP.

If you're interested in checking out more of our results, the following links lead to the pre-print paper and the GitHub repository, respectively (The image used in this post is taken from our pre-print paper):

🧠 NPB-Rust pre-print paper: https://arxiv.org/abs/2502.15536

🔗 NPB-Rust GitHub: https://github.com/GMAP/NPB-Rust

...

I'm a member of GMAP (Parallel Application Modeling Group) at PUCRS (Pontifical Catholic University of Rio Grande do Su), where we focus on research related to high-performance computing. The NPB-Rust project is still in progress.

Partial result of our pre-print paper.