You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Dick Cavender (Jira)" <ji...@apache.org> on 2019/09/26 18:03:06 UTC

[jira] [Closed] (GEODE-6676) org.apache.geode.internal.ByteArrayDataInput.readUTF is not optimal for ASCII strings

     [ https://issues.apache.org/jira/browse/GEODE-6676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dick Cavender closed GEODE-6676.
--------------------------------

> 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: Minor
>              Labels: performance
>             Fix For: 1.10.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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
(v8.3.4#803005)