I wonder how fast we'd do

H. S. Teoh hsteoh at quickfur.ath.cx
Thu May 30 17:13:19 UTC 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!


More information about the Digitalmars-d mailing list