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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 5 23:27:29 PDT 2016


On 6/4/16 7:35 PM, 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!

Clearly improving range-specific optimizations will "lift all boats". 
But specializing code for specific range kinds is in principle a good 
thing. See e.g. the recent thread about nextPermutation - we should not 
be ashamed to specialize it for random-access ranges.

Andrei



More information about the Digitalmars-d mailing list