I wonder how fast we'd do

Nicholas Wilson iamthewilsonator at hotmail.com
Tue May 28 15:57:12 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.

Indeed, the only thing that usually has any effect is aliasing 
rules, and the occasional convincing the code generator to do 
non-temporal ops. The REAL power of the frontend language is to 
make it aware to the optimiser that the code is redundant, 'cause 
theres no faster code than no code at all. Thats why I'm really 
excited to see what we could use MLIR[1] for in LDC.

[1]: https://github.com/tensorflow/mlir/


More information about the Digitalmars-d mailing list