You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "ramkrishna.s.vasudevan (JIRA)" <ji...@apache.org> on 2019/07/10 09:43:00 UTC

[jira] [Created] (HBASE-22671) ByteBufferUtils#findCommonPrefix() can be safely changed to ArraysSupport#mismatch()

ramkrishna.s.vasudevan created HBASE-22671:
----------------------------------------------

             Summary: ByteBufferUtils#findCommonPrefix() can be safely changed to ArraysSupport#mismatch()
                 Key: HBASE-22671
                 URL: https://issues.apache.org/jira/browse/HBASE-22671
             Project: HBase
          Issue Type: Sub-task
    Affects Versions: 3.0.0
            Reporter: ramkrishna.s.vasudevan
            Assignee: ramkrishna.s.vasudevan


Microbenchmarks reveal that finding the common prefix for encoders can safely be replaced with ArraysSupport#mismatch().
the microbenchmark just compares Cells that are backed with array and BB. 
For a 27 bit common row prefix the existing BBUtils#findCommonPrefix
{code}
Benchmark                        Mode  Cnt    Score    Error  Units
PrefixComparator.arrayBBCompare  avgt   10  869.897 ±  9.429  ns/op
PrefixComparator.arrayCompare    avgt   10  302.074 ± 13.448  ns/op
PrefixComparator.bbArrayCompare  avgt   10  869.369 ±  5.368  ns/op
PrefixComparator.bbCompare       avgt   10  409.479 ±  1.587  ns/op
{code}

the same with ArraysSupport#mismatch() change gives this
{code}
Benchmark                        Mode  Cnt    Score   Error  Units
PrefixComparator.arrayBBCompare  avgt   10  311.946 ± 1.902  ns/op
PrefixComparator.arrayCompare    avgt   10  157.010 ± 4.482  ns/op
PrefixComparator.bbArrayCompare  avgt   10  311.568 ± 1.348  ns/op
PrefixComparator.bbCompare       avgt   10   92.540 ± 0.501  ns/op
{code}

How ever note that this comes in flushes/compaction and not during the read path. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)