faster splitter

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 1 06:43:26 PDT 2016


On 06/01/2016 08:41 AM, Seb wrote:
> On Wednesday, 1 June 2016 at 12:14:07 UTC, Patrick Schluter wrote:
>> On Tuesday, 31 May 2016 at 17:54:34 UTC, qznc wrote:
>>> There is a special version of find for searching a single char in a
>>> string. Using a one-letter needle string is more like a user mistake
>>> than something to optimize for.
>>
>> At compile time you may not know the length of the needle, like in the
>> grep command.
>
> 1) how about a CTFE find?
>
> s.find!(needle, pred)
>
> If we can initialize boyer-moore or KMP at compile time - it should be
> the fastest!

That would require partial evaluation, which sadly we don't have in D. 
-- Andrei



More information about the Digitalmars-d mailing list