May 29, 2019
On 5/28/2019 5:22 PM, H. S. Teoh wrote:
> Does dmd unroll loops yet? That appears to be a major cause of
> suboptimal codegen in dmd, last time I checked. Would be nice to improve
> this.

https://digitalmars.com/d/archives/digitalmars/D/I_wonder_how_fast_we_d_do_327428.html#N327436
May 29, 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!
May 30, 2019
On Wed, May 29, 2019 at 09:00:15AM +0000, Atila Neves via Digitalmars-d wrote:
> On Tuesday, 28 May 2019 at 14:20:30 UTC, Guillaume Piolat wrote:
[...]
> > 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!

They should *not* pay a performance penalty, otherwise I'd stop using them right away!  They are supposed to be a nicer, higher-level way of writing loops (without most of the gotchas, boilerplate, and unreusability), but at the bottom they should translate to basically exactly the same thing as writing out the loops manually. I expect nothing less from a modern optimizing compiler.


T

-- 
Turning your clock 15 minutes ahead won't cure lateness---you're just making time go faster!
1 2 3
Next ›   Last »