[
https://issues.apache.org/jira/browse/HBASE-17235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15714354#comment-15714354
]
Anoop Sam John commented on HBASE-17235:
----------------------------------------
That looks better. ya.. I was wondering why the new boolean based static
creator is not exposed as public. Ya all Unsafe way (unsafe if u r not sure
whether ur backing data structure is immutable) done via Unsafe*** is better.
Can do the fix in ByteInput via a new jira as that has to patch PB.
On the patch u have to call cis.enableAliasing(true); also. Then only it will
avoid copying.
Now if and else block both need this enableAliasing call and so put it outside.
Can fix that on commit. +1
> Minor improvement in creation of CIS for onheap buffer cases
> ------------------------------------------------------------
>
> Key: HBASE-17235
> URL: https://issues.apache.org/jira/browse/HBASE-17235
> Project: HBase
> Issue Type: Improvement
> Components: rpc
> Affects Versions: 2.0.0
> Reporter: ramkrishna.s.vasudevan
> Assignee: ramkrishna.s.vasudevan
> Priority: Minor
> Fix For: 2.0.0
>
> Attachments: HBASE-17235.patch
>
>
> {code}
> if (buf.hasArray()) {
> cis = CodedInputStream.newInstance(buf.array(), offset, buf.limit());
> } else {
> {code}
> Currently we do this for onheap buffers incase there is no reservoir or the
> size is less than the minSizeforReservoir. I could see that even if reservoir
> is there there are requests which goes with the above way of creating CIS.
> This could be made efficient to avoid underlying copies by just doing this
> {code}
> cis = UnsafeByteOperations.unsafeWrap(buf.array(), offset,
> buf.limit()).newCodedInput();
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)