surrogates optimization

[email protected] ("Tex Texin")
Newsgroups php.i18n
Message-ID <[email protected]>
Suggestion for improving the performance of indexing strings:

Associate with the string the index of the first code unit that is a
surrogate.
Since most strings will have no surrogates, these strings will have a value
greater than the length of the string, and this tells you that you can index
directly into the string. When there is a surrogate, you can index directly,
prior to the surrogate's index.

If there is a surrogate then you can consider the meta data for remembering
which chars used surrogates, to optimize indexing as was proposed.

This is low cost, very efficient... Most strings won't have surrogates.
tex
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.