More suggestions for find()

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 20 08:17:07 PDT 2016


On 6/20/16 8:34 AM, qznc wrote:
> On Sunday, 19 June 2016 at 10:38:27 UTC, qznc wrote:
>> On Saturday, 18 June 2016 at 18:54:28 UTC, Andrei Alexandrescu wrote:
>>> Got this link from the reddit discussion around the blog article:
>>> http://effbot.org/zone/stringlib.htm. The Bloom-filter-style trick
>>> looks quite cool. Anyone interested in running some more experiments?
>>> Thx! -- Andrei
>>
>> Compare with memmem. That is 4x faster than the current stuff. I guess
>> vector instructions are key. There is a branch in my repo.
>
[snip]

Super cool! One thought - the current algorithm
computes a "skip". In the case of Alice in Wonderland, that skip is 
relatively small, I recall like 4. If the skip is large enough, the 
current algorithm is faster than memmem. So it would be best to compute 
the skip and then switch to memmem if the skip falls below a cutoff. -- 
Andrei


More information about the Digitalmars-d mailing list