I wonder how fast we'd do

Atila Neves atila.neves at gmail.com
Wed May 29 09:00:15 UTC 2019


On Tuesday, 28 May 2019 at 14:20:30 UTC, Guillaume Piolat wrote:
> On Tuesday, 28 May 2019 at 09:49:26 UTC, Atila Neves wrote:
>>
>> Much to my surprise, C, C++, D and Rust all had the same 
>> performance as each other, independently of whether C++, D and 
>> Rust used ranges/algorithm/streams or plain loops. All done 
>> with -O2, all LLVM.
>
> This really isn't _that_ surprising.
>
> Once properly optimized, native code is the same speed for 
> every input language.
> C, C++, D and Rust all have a "no room below" ethic in most 
> cases, so you end up with the very same performance. Barring 
> anomalies like bounds check or integer overflow checks.
>
> Comparisons of backends would be much more interesting, but 
> drive less interest on Internet forums.

Sure. I wasn't surprised the loop versions were all the same, 
it'd be weird if they weren't. I was surprised that the 
algorithm/range/iterator versions didn't pay a performance 
penalty!


More information about the Digitalmars-d mailing list