hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-14120) ByteBufferUtils#compareTo small optimization
Date Mon, 20 Jul 2015 15:06:05 GMT

    [ https://issues.apache.org/jira/browse/HBASE-14120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14633670#comment-14633670
] 

Hudson commented on HBASE-14120:
--------------------------------

FAILURE: Integrated in HBase-TRUNK #6664 (See [https://builds.apache.org/job/HBase-TRUNK/6664/])
HBASE-14120 ByteBufferUtils#compareTo small optimization. (anoopsamjohn: rev 88038cf473a17a6b059902e080f1bc10d338b7c9)
* hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java


> ByteBufferUtils#compareTo small optimization
> --------------------------------------------
>
>                 Key: HBASE-14120
>                 URL: https://issues.apache.org/jira/browse/HBASE-14120
>             Project: HBase
>          Issue Type: Sub-task
>          Components: regionserver, Scanners
>            Reporter: Anoop Sam John
>            Assignee: Anoop Sam John
>             Fix For: 2.0.0
>
>         Attachments: HBASE-14120.patch
>
>
> We have it like
> {code}
> if (UnsafeAccess.isAvailable()) {
>   long offset1Adj, offset2Adj;
>   Object refObj1 = null, refObj2 = null;
>   if (buf1.hasArray()) {
> 	offset1Adj = o1 + buf1.arrayOffset() + UnsafeAccess.BYTE_ARRAY_BASE_OFFSET;
> 	refObj1 = buf1.array();
>   } else {
> 	offset1Adj = o1 + ((DirectBuffer) buf1).address();
>   }
>   if (buf2.hasArray()) {
> {code}
> Instead of hasArray() check we can have isDirect() check and reverse the if else block.
Because we will be making BB backed cells when it is offheap BB. So when code reaches here
for comparison, it will be direct BB.
> Doing JMH test proves it.
> {code}
> Benchmark                            Mode  Cnt         Score         Error  Units
> OnHeapVsOffHeapComparer.offheap     thrpt    4  50516432.643 ±  651828.103  ops/s
> OnHeapVsOffHeapComparer.offheapOld  thrpt    4  37696698.093 ± 1121685.293  ops/s
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message