www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [WORK] startsWith

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
I just submitted an optimization for skipOver for strings: 
https://github.com/D-Programming-Language/phobos/pull/2986.

I noticed startsWith should be similarly optimized. If anyone would want 
to work on that, it would be great.


Thanks,

Andrei
Feb 14 2015
parent "Ulrich =?UTF-8?B?S8O8dHRsZXIi?= <kuettler gmail.com> writes:
On Saturday, 14 February 2015 at 17:52:09 UTC, Andrei 
Alexandrescu wrote:
 I just submitted an optimization for skipOver for strings: 
 https://github.com/D-Programming-Language/phobos/pull/2986.

 I noticed startsWith should be similarly optimized. If anyone 
 would want to work on that, it would be great.
The range version of startsWith (which I suspect is the most commonly used one) is optimized beautifully. This leaves the (rather trivial) single element one and the "one haystack, any of these needles" one.
Feb 14 2015