ClassReader.readUtf and compact strings

Eirik Bjørsnøs (via asm Mailing List) <[email protected]> Sat, 6 Feb 2021 10:31:03 +0100
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CA+pBWhu07NdB=P46B2m8m+=E7hioWChXT0__TYc-uGyQR8eqKg@mail.gmail.com>
This is a multi-part message in MIME format...

------------=_1612603879-15976-5
Content-Type: multipart/alternative; boundary="00000000000010139205baa7991b"

--00000000000010139205baa7991b
Content-Type: text/plain; charset="UTF-8"

Hi,

ClassReader.readUtf currently parses UTF-8 bytes into a char[] which it
then uses to construct a String.

The String(char[]) constructor then calls StringUTF16.compress(char[]..)
which nicely packs the char[] back into a byte[].

I imagine there could be a performance win of not doing this byte[] ->
char[] -> byte[] dance, given that most class strings are ASCII anyway.

WDYT?

Eirik.

--00000000000010139205baa7991b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>ClassReader.readUtf currently parse=
s UTF-8 bytes into a char[] which it then uses to construct a String.</div>=
<div><br></div><div>The String(char[]) constructor then calls=C2=A0StringUT=
F16.compress(char[]..) which nicely packs the char[] back into a byte[].</d=
iv><div><br></div><div>I imagine there could be a performance win of not do=
ing this byte[] -&gt; char[] -&gt; byte[] dance, given that most class stri=
ngs=C2=A0are ASCII anyway.</div><div><br></div><div>WDYT?</div><div><br></d=
iv><div>Eirik.</div></div>

--00000000000010139205baa7991b--

------------=_1612603879-15976-5
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

------------=_1612603879-15976-5--