Performance penalty for using ranges

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Aug 25 14:47:27 PDT 2013


On 25/08/13 23:11, Timon Gehr wrote:
> Why would that be the case?

I don't know why it _need_ be the case, but it _is_ the case in practice right now.

The precise example I cited of a for() loop with decreasing value, I tried 
replacing using retro and iota -- and it was significantly slower.

Ditto foreach's over iota() -- even though in principle there is no conceptual 
difference between foreach(i; m .. n) and foreach(i; iota(m, n)), and it ought 
to be possible for the two to reduce to the same machine code, there is right 
now a performance hit.


More information about the Digitalmars-d mailing list