[
https://issues.apache.org/jira/browse/ZOOKEEPER-324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12965852#action_12965852
]
Benjamin Reed commented on ZOOKEEPER-324:
-----------------------------------------
one thing to note is that on the server we never need to convert to and from
Strings. the idea is to read in the path as byte[], and do all the processing
using byte[].
another thing to consider is that wrapping byte[] is going to consume at least
8 bytes for the object header (on 32-bit) and another 4 for the pointer to the
byte array. so you are burning at least 12 bytes or more on 64-bit machines.
> do not materialize strings in the server
> ----------------------------------------
>
> Key: ZOOKEEPER-324
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-324
> Project: ZooKeeper
> Issue Type: Improvement
> Components: server
> Reporter: Benjamin Reed
>
> We convert paths and authentication information to strings rather than byte[]
> even though we could work just as well with byte[] for our needs since we
> don't really interpret the strings. we are just doing basic pattern matching.
> the only really string manipulations we do with paths is to look for '/', but
> we could easily to that with byte[] since we use utf8 encoding for the
> strings. by not materializing the strings we save time doing the
> serializations and also space since most (almost all) of our strings are
> ASCII and thus just one byte.
> we could probably get by without even changing the jute spec if we make the
> generated classes check for a flag to see whether strings should be treated
> as byte[] or String.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.