optimising OUString for space

Noel Grandin noel at peralex.com
Mon Oct 1 04:55:04 PDT 2012


On 2012-10-01 13:47, Michael Stahl wrote:
> ... which brings me to another point: in a hypothetical future when we 
> could efficiently create a UTF8String from a string literal in C++ 
> without copying the darn thing, what should hypothetical operations to 
> mutate the string's buffer do?

We need external iterators that store the byte index of the current 
code-point as part of their state.
Update operations would then take that iterator as a parameter, so that 
they'd know where to start mutating from.
Then it becomes a case of carefully shuffling the correct number of 
bytes around, bearing in mind that a unicode code-point may be anything 
from one to four bytes long.

Or are you talking about memory management?
The current OUString class allocates a new character buffer for every 
mutation, I assume we'd keep that strategy.


Disclaimer: http://www.peralex.com/disclaimer.html




More information about the LibreOffice mailing list