On Tuesday, 4 August 2015 at 18:56:20 UTC, jmh530 wrote:

I don't think I had seen an example like this before (though it is obvious in retrospect). Is there any advantage in terms of performance?

The big win is in terms of being able to write complicated, correct code easily. However, there was a recent thread on the topic: http://forum.dlang.org/post/mailman.4829.1434623275.7663.digitalmar...@puremagic.com

Walter said, "I expect that at the moment, range+algorithms code will likely be somewhat slower than old fashioned loops. This is because code generators have been tuned for decades to do a great job with loops.

There's no intrinsic reason why ranges must do worse, so I expect they'll achieve parity.

Ranges can move ahead because they can reduce the algorithmic complexity, whereas user written loops tend to be suboptimal."

Reply via email to