Re: surrogates optimization
| From: | Andrei Zmievski | Date: | Wed, 08 Mar 2006 16:48:34 +0000 |
| Subject: | Re: surrogates optimization | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-963@lists.php.net to get a copy of this message | ||
Tex,
This approach would work only if we allowed access to the string contents always via regimented API. Unfortunately, many third party extensions (and many bundled ones) simply change the contents of the string directly via a pointer.. I am not sure we could standardize this.
-Andrei
On Mar 8, 2006, at 1:35 AM, Tex Texin wrote:
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