faster splitter

Chris via Digitalmars-d digitalmars-d at puremagic.com
Mon May 30 11:57:15 PDT 2016


On Monday, 30 May 2016 at 18:20:39 UTC, Andrei Alexandrescu wrote:
>
> Please throw this hat into the ring as well: it should improve 
> average search on large vocabulary dramatically.
>
> https://dpaste.dzfl.pl/dc8dc6e1eb53
>
> It uses a BM-inspired trick - once the last characters matched, 
> if the match subsequently fails it needn't start from the next 
> character in the haystack. The "skip" is computed lazily and in 
> a separate function so as to keep the loop tight. All in all a 
> routine worth a look. I wanted to write this for a long time. 
> -- Andrei

Cool. So far, my experience with separate functions has been that 
they slow down the loop. But this might do the trick.


More information about the Digitalmars-d mailing list