More suggestions for find()

Guillaume Chatelet via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 21 00:33:28 PDT 2016


On Monday, 20 June 2016 at 16:09:21 UTC, qznc wrote:
> On Monday, 20 June 2016 at 13:27:59 UTC, Jack Stouffer wrote:
>> On Monday, 20 June 2016 at 12:34:55 UTC, 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:
>>>>> [...]
>>>>
>>>> Compare with memmem. That is 4x faster than the current 
>>>> stuff. I guess vector instructions are key. There is a 
>>>> branch in my repo.
>>>
>>> More like 2x after looking again
>>
>> Cool :)
>>
>> What are the chances of getting this in Phobos?
>
> Low.
>
> It requires the GNU libc to link against. We don't want that 
> dependency.
>
> We cannot port it directly since it is GPL code.
>
> It is even more of a special case, since it only works for the 
> == predicate.
>
> I'm not sure about the vector instructions it requires.
>
> What we need is a clean room implementation of the two way 
> string matching algorithm with vector instructions?

Maybe there's some inspiration to get from the source code:
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=string/memmem.c;hb=HEAD
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=string/str-two-way.h;hb=HEAD


More information about the Digitalmars-d mailing list