This is wrong, Rust is not faster than GCC (but is sometimes faster than Clang), see this discussion
I implemented the Mersenne Twister random number generator in Rust, and then compared the Rust one with the fastest non-Rust one I could find (mt19937ar-cok.c
on this page):
** Rust **
1040076681
real 0m4.470s
user 0m4.444s
sys 0m0.004s
1040076681
real 0m4.399s
user 0m4.384s
sys 0m0.004s
1040076681
real 0m4.347s
user 0m4.336s
sys 0m0.000s
** C **
1040076681
real 0m4.592s
user 0m4.568s
sys 0m0.000s
1040076681
real 0m4.516s
user 0m4.484s
sys 0m0.000s
1040076681
real 0m4.502s
user 0m4.488s
sys 0m0.004s
(Summing 1,000,000,000 random u32
s. The Rust was compiled with rustc --opt-level=3
and the C gcc -O3
.)
Just curious, where is your implementation of the Mersenne Twister in Rust?