You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java has no performant API to access String content. Colfer version 1 uses charAt which causes range checks on every UTF-16 character. All other access methods are even slower due to memory allocation.
for (java.lang.reflect.Fieldf : String.class.getDeclaredFields())
System.err.printf("%s %s %s\n", java.lang.reflect.Modifier.toString(f.getModifiers()), f.getType().getTypeName(), f.getName());
The String class in LTS version 8 has a private final char[] value payload. LTS version 11, 17, 21, and the OpenJDK moved to the following layout.
private final byte[] value
private final byte coder
static final boolean COMPACT_STRINGS
static final byte LATIN1
static final byte UTF16
The coder can be either LATIN1 for ISO 8859-1, or UTF-16 for big-endian bytes. COMPACT_STRINGS must be read as well because LATIN1 is 0 and UTF-16 is 1 instead of the other way around. 🤦
The text was updated successfully, but these errors were encountered:
Java has no performant API to access
String
content. Colfer version 1 usescharAt
which causes range checks on every UTF-16 character. All other access methods are even slower due to memory allocation.The
String
class in LTS version 8 has aprivate final char[] value
payload. LTS version 11, 17, 21, and the OpenJDK moved to the following layout.The
coder
can be eitherLATIN1
for ISO 8859-1, orUTF-16
for big-endian bytes.COMPACT_STRINGS
must be read as well becauseLATIN1
is0
andUTF-16
is1
instead of the other way around. 🤦The text was updated successfully, but these errors were encountered: