Ceci n'est pas une char
kris
foo at bar.com
Thu Apr 6 19:04:44 PDT 2006
Walter Bright wrote:
> Thomas Kuehne wrote:
>
>> Challenge:
>> Provide a D implementation that firsts converts to UTF-32 and has
>> shorter runtime than the code below:
>
>
> I don't know about that, but the code below isn't optimal <g>. Replace
> the sar's with a lookup of the 'stride' of the UTF-8 character (see
> std.utf.UTF8stride[]). An implementation is std.utf.toUTFindex().
It's not as simple as that any more. Lookup tables can sometimes cause
more stalls that straight-line code, especially with designs such as the
P4. Not to mention the possibility of a bit of cache-thrashing with
other programs.
Thus, the lookup may be sub-optimal. Quite possibly less optimal.
More information about the Digitalmars-d
mailing list