Reduce has dreadful performance?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 18 13:53:28 PDT 2015


On 6/18/2015 7:04 AM, Russel Winder via Digitalmars-d wrote:
> Now I get
>
> Loop: 3.14s
> Reduce 1: 4.76s
> Reduce 2: 5.12s


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.



More information about the Digitalmars-d mailing list