optimising OUString for space

Norbert Thiebaud nthiebaud at gmail.com
Mon Oct 1 08:29:43 PDT 2012


On Mon, Oct 1, 2012 at 9:05 AM, Stephan Bergmann <sbergman at redhat.com> wrote:
> Note that in the common case of accessing (i.e., searching for, etc.) 7-bit
> ASCII content in a string, regardless of whether it is internally
> represented as UTF-8 or UTF-16, going via an operator[] interface that
> operates directly on the string object's innards might be more efficient
> than going via an iterator interface (which is, of course, necessary when
> potentially accessing non-ASCII content).
>

otoh, if we never had a [] access anywhere, we could use utf-8 as a backend.
The space saving (memory and therefor d-cache pressure) and the
removal of the need to have 2 set of classes (one for SBCS and one for
UCS-2)
may actually be worth the exta cost in these cases (indexed access)

Norbert


More information about the LibreOffice mailing list