Reduce has dreadful performance?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 18 15:54:44 PDT 2015


On 6/18/15 2:04 PM, weaselcat wrote:
> On Thursday, 18 June 2015 at 20:53:20 UTC, Walter Bright wrote:
>> 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.
>
> ldc and gdc have no issue optimizing the range code(range code is
> actually faster with ldc)

Russel, do you have numbers for ldc by any chance? Thx! -- Andrei



More information about the Digitalmars-d mailing list