Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index



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
UTF-8.
        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 JDK7.
http://stackoverflow.com/questions/8833385/is-support-for-compressed-strings-being-dropped
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.

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



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.