[rust-dev] Porting a small DSP test from C++ to Rust: Comments and performance observations

Learn OpenGL ES learnopengles at gmail.com
Wed Jun 11 05:51:05 PDT 2014

So I feel a little sheepish now, as I tried the C++ code again with LTO turned off, and it’s now slightly faster than the Rust version. I guess it’s a performance regression that gets triggered by LTO in this specific case. 

Here are the results I get now:

clang PerformanceTest.cpp dsp.cpp -std=c++11 -ffast-math -O3 -o PerformanceTest

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix

Iterations: 955
C results: 100,043,846 shorts per second.

Rust is still very competitive with 93M shorts/second, and I would hope to see the gap narrowed or eliminated as the compiler & language continue to be improved.

The code is also now available here if anyone is interested: https://gist.github.com/learnopengles/004ff4eee75057ca006c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140611/7c3300c9/attachment.html>

More information about the Rust-dev mailing list