top | item 20798415

(no title)

ros65536 | 6 years ago

For the difference between rust and C++ I'd say is caused by the difference between rustc+llvm and msvc++ compilers. Compiling C++ under clang should give more comparable results

discuss

order

pingyong|6 years ago

I did find it frustrating that Clang wasn't the first thing he tried. But he did eventually try Clang past the end of the post (when it should've been at the top). Interestingly though, Clang doesn't bridge the gap.

tom_mellior|6 years ago

> Interestingly though, Clang doesn't bridge the gap.

That might be due to differences in the code, but it might just as well be due to differences in the flags that rustc and Clang pass to the backend by default. It's not even clear what optimization level they asked for.

masklinn|6 years ago

Also might be worth benching #[inline(never)], as the heuristic difference between a small benchmark and a larger program can lead to different behaviour.

Narishma|6 years ago

It's mentioned at the end of the article that clang doesn't make much of a difference.