[
https://issues.apache.org/jira/browse/GEODE-6676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Darrel Schneider updated GEODE-6676:
------------------------------------
Labels: performance (was: )
> org.apache.geode.internal.ByteArrayDataInput.readUTF is not optimal for ASCII
> strings
> -------------------------------------------------------------------------------------
>
> Key: GEODE-6676
> URL: https://issues.apache.org/jira/browse/GEODE-6676
> Project: Geode
> Issue Type: Improvement
> Components: core
> Reporter: Darrel Schneider
> Assignee: Darrel Schneider
> Priority: Major
> Labels: performance
>
> org.apache.geode.internal.ByteArrayDataInput.readUTF(), given ASCII bytes,
> copies those bytes into a char array. It then allocates a new String with
> that char array.
> As of jdk 9, java.lang.String will take that char array and copy it back to a
> byte array.
> We can save a copy by using String(byte[], int, int, int). This does require
> us to do a scan to make sure all the byte values are less than 128. As soon
> as we see one that is not we can break out of the scan and do the normal utfÂ
> encode logic. But if all our Strings are ASCII, this will save a copy and the
> char array used for UTF encoding never needs to be allocated.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)