String Prefix Predicate

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 16 14:04:05 PDT 2014


On Saturday, 16 August 2014 at 20:59:47 UTC, monarch_dodra wrote:
> If anything, you are *preventing* the (many) opportunities 
> phobos has to *avoid* decoding when it can...

By that I want to stress what Jonathan M Davis said
"Unless the string types match, there's no way around it."

You should absolutely realize that that means that when the 
string types (widths) *do* match, then "search" (which includes 
all flavors in phobos) will NOT decode.

Heck, if you do a "string, element" search, eg find("my phrase", 
someDchar), then phobos will *encode* someDchar into a correctly 
sized string, and then do a full non-decoding string-string 
search, which is actually much faster than the naive decoding 
search.


More information about the Digitalmars-d-learn mailing list