A while ago I did a comparison between C and Rust to start learning the language and also to check out the relative performance between the two, since the main times I drop down to C are for performance reasons. I recently brought the Rust code up to compliance with 1.0 and re-ran the tests, and in my results, Rust is only able to reach 70% of the speed that I get with the C++ implementation.
Since both compile to native and Rust aims for zero-cost abstractions, ideally the Rust version should not be slower than the C++ version. I still consider myself a newbie to Rust so it’s possible I’m doing a few things (or more than a few things!) that I shouldn’t be. Could this be related to bounds check or something else?
Here’s the code: https://gist.github.com/anonymous/fd213a7b8ffdcfd219dc