Major performance problem with std.array.front()

Michel Fortin michel.fortin at michelf.ca
Sun Mar 9 07:54:11 PDT 2014


On 2014-03-09 14:12:28 +0000, "Marc Schütz" <schuetzm at gmx.net> said:

> That won't work, because your needle might be in a different 
> normalization form than your haystack, thus a byte-by-byte comparison 
> will not be able to find it.

The core of the problem is that sometime this byte-by-byte comparison 
is exactly what you want; when searching for some terminal character(s) 
in some kind of parser for instance.

Other times you want to do a proper Unicode search using Unicode 
comparison algorithms; when the user is searching for a particular 
string in a text document for instance.

The former is very easy to do with the current API. But what's the API 
for the later?

And how to make the correct API the obvious choice depending on the use case?

These two questions are what this thread should be about. Although not 
unimportant, performance of std.array.front() and whether it should 
decode is a secondary issue in comparison.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca



More information about the Digitalmars-d mailing list