Performance of loops
Chris via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 24 06:13:04 PDT 2015
On Friday, 24 April 2015 at 11:53:56 UTC, Marc Schütz wrote:
> Most of the time is taken up by the array's allocation. The
> optimizers of both DMD and LDC evidently doesn't optimize it
> away when you use `ref`, even though it could in theory.
>
> Remove the `enum` and just use a normal global variable, and
> you will get more or less identical times for all three loops.
> LDC even turns then into empty functions (didn't check for DMD).
I've tried it, and the loops indeed show similar results. What is
it about `enum` that slows it down?
More information about the Digitalmars-d
mailing list