faster splitter

qznc via Digitalmars-d digitalmars-d at puremagic.com
Fri May 27 14:27:04 PDT 2016


On Friday, 27 May 2016 at 20:50:52 UTC, Andrei Alexandrescu wrote:
> On 05/27/2016 04:39 PM, qznc wrote:
>> Now added Chris' algo to the benchmark:
>>
>> std find:    155 ±33
>> manual find: 112 ±19
>> qznc find:   122 ±18  <--- improved find
>> Chris find:  133 ±20  <--- findStringS_
>
> Does any of these feature simultaneously:
>
> * check the last element first
> * consequently stop early when the length of the haystack falls 
> below the length of the needle
> * consequently no check against the haystack limit is necessary 
> in the inner loop

Std find (currently in Phobos) and qznc find (see pull request) 
fulfill those three. Manual and Chris find are simpler.

> * use only one induction variable

None of those. I made such a variant of qznc find and it gives me 
the same numbers.



More information about the Digitalmars-d mailing list