Performance of ranges verses direct

John Colvin john.loughran.colvin at gmail.com
Thu Dec 12 07:02:28 PST 2013


On Wednesday, 11 December 2013 at 16:40:48 UTC, Joseph Rushton 
Wakeling wrote:
> [* If I recall right, it's achievable by special-casing iota 
> when the increment is 1, but don't quote me on that.]

That shouldn't be necessary if the iota operations are inlined 
(which, if their not, is a much greater concern!). The increment 
is then known to be a particular compile-time constant and code 
generated appropriately.

Also, on x86 the gcc and llvm backends both prefer to use add 1 
instead of inc, so you wouldn't even expect to see any difference 
at that level.


More information about the Digitalmars-d-learn mailing list