Let's avoid range specializations - make ranges great again!

Era Scarecrow via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 4 13:55:38 PDT 2016


On Saturday, 4 June 2016 at 17:35:23 UTC, Seb wrote:
> In Phobos (especially in std.algorithm) a lot of specialization 
> between a RandomAccessRange and an InputRange are used even 
> though only an InputRange is required. The reason for this is 
> solely performance - imho we should start to tackle this and 
> remove such specializations. Let's create better code!

> The reason for this is solely performance - we should <snip> 
> remove such specializations.

  Performance will always be a driving factor. But then again 
let's not forget an array is not a range, and isn't treated as 
one unless the primitives are present (which by default they are 
not).

  Arrays in their basic forms are also very common, easy, fairly 
cheap, etc. Same as slices. I see no reason to drop array based 
specializations, unless they fail to produce good code.


More information about the Digitalmars-d mailing list