Performance of ranges verses direct
Marco Leise
Marco.Leise at gmx.de
Thu Dec 12 05:27:21 PST 2013
Am Wed, 11 Dec 2013 17:40:39 +0100
schrieb Joseph Rushton Wakeling <joseph.wakeling at webdrake.net>:
> On 11/12/13 11:10, John Colvin wrote:
> > A lot of the performance loss is down to missed optimisations, in particular
> > inlining.
>
> Simple example:
>
> foreach(i; iota(0, 10)) { ... }
>
> should be as fast as
>
> foreach(i; 0 .. 10) { ... }
>
> but isn't. I remember Andrei noting that this ought to be easily fixable [*],
> but I don't know if that actually happened, because I haven't compared the two
> recently.
As far as I remember it *is* the same speed using GDC or LDC.
But as long as this issue remains with DMD I'm confident that
foreach_reverse(i; 0 .. 10) will stay :)
--
Marco
More information about the Digitalmars-d-learn
mailing list