optimising OUString for space
noel at peralex.com
Mon Oct 1 04:37:24 PDT 2012
On 2012-10-01 13:25, Michael Meeks wrote:
>> The latest Java VM does this trick internally - it pretends that String
>> is stored with an array of 16-bit values, but actually it stores them as
> Interesting - for all strings ? is there a pointer to the code / docs
> for that detail somewhere ? :-)
It's a "magic" thing. The VM overrides the language level definition of
java.lang.String with it's own.
Hmm, pity, looks like they introduced it in JDK6 and then dropped it in
Looks like the backwards compatibility overhead was too high.
> Last I looked Java also stored partial
> strings chained to it's parent; so 'substring' takes a reference on the
> parent (be it ever so large), and can return a single character string
> out of it without re-allocation. IIRC that can cause huge grief when
> parsing big files into little ones ;-)
That "optimisation" is being dropped in JDK8, for precisely that reason.
More information about the LibreOffice