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).
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.
- Performance of loops Chris via Digitalmars-d
- Re: Performance of loops John Colvin via Digitalmars-d
- Re: Performance of loops Chris via Digitalmars-d
- Re: Performance of loops via Digitalmars-d
- Re: Performance of loops Chris via Digitalmars-d
- Re: Performance of loo... Steven Schveighoffer via Digitalmars-d
- Re: Performance of... Chris via Digitalmars-d
- Re: Performance of loops Baz via Digitalmars-d
- Re: Performance of loops Chris via Digitalmars-d