faster splitter

qznc via Digitalmars-d digitalmars-d at puremagic.com
Mon May 23 07:47:22 PDT 2016


On Monday, 23 May 2016 at 14:25:52 UTC, Jack Stouffer wrote:
> On Monday, 23 May 2016 at 14:17:59 UTC, Andrei Alexandrescu 
> wrote:
>> What would be the condition tested in the static if?
>
> I would assume `static if (isBidirectionalRange!Range)`
>
>> Recall that sometimes you do want a forward range even when 
>> you could define a bidirectional range. -- Andrei
>
> I honestly can't think of a time when would this be the case. 
> What are you losing by having back and popBack defined?

Here is a commit, which removes the dead code:

https://github.com/qznc/phobos/commit/0cb1e70f4504a52b81c30342be7ec26d597fac69

It would be strictly better to implement the back and popBack, no?

My single test case says removing the code does not result in 
faster code. Maybe dmd optimizes the bookkeeping away.

I see three options:

1. Remove dead bookkeeping code
2. Implement back() and popBack()
3. Use alternative splitter implementation (and implement back() 
and popBack())

The third one would be the best, if it is really faster.


More information about the Digitalmars-d mailing list