4 ms·
Is this Windows or Linux? Also what CPU? Your results for rust on LLVM15 are pretty much close to mine but clang++ on LLVM15 is almost twice as slow. I really w
by FpUser 4y ago
Is this Windows or Linux? Also what CPU? Your results for rust on LLVM15 are pretty much close to mine but clang++ on LLVM15 is almost twice as slow. I really want to find reason.
- FpUser 4y agoNever mind, figured it out: clang++ -O3 -mavx2 fts_cpp_copy_bench.cpp -o test.exe this did it. The final score is: rust - By-Copy: 2683, By-Borrow: 2697 c++ - By-Copy: 2577, By-Ref: 2600 so C++ seems a bit faster but not by much
- josephg 4y agoAre you enabling avx2 for rust as well? What arguments are you using for rust? Try this: RUSTFLAGS="-C target-cpu=native" cargo run --release # or whatever And: clang++ -O3 -march=native fts_cpp_copy_bench.cpp -o test.exe arch=native will also activate SSE, MMX, and all the other goodies that modern CPUs have to offer.
- FpUser 4y agoSorry for being dumb, I thought I've enabled it in ./cargo/config.toml for rust. Checked it again and it appears that I did not (the file name was wrong). -march=native for CLang also did better than just avx2 rust - By-Copy: 1831, By-Borrow: 1850 c++ - By-Copy: 2411, By-Ref: 2458 Interesting why Rust wins with such a large margin. Maybe will try to find out later.