[
https://issues.apache.org/jira/browse/HBASE-17332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15760677#comment-15760677
]
binlijin commented on HBASE-17332:
----------------------------------
{quote}
encoderId < 0 || encoderId > Byte.MAX_VALUE
This check can be in getEncodingById? If test dont pass can return null as
DataBlockEncoding so that the calling places can throw Exception.
{quote}
Looks good, move the check into getEncodingById, but what about move the throw
Exception into getEncodingById also?
{quote}
encoderId > Byte.MAX_VALUE - Check has to be encoderId >= Byte.MAX_VALUE?
{quote}
The array size is 128, and Byte.MAX_VALUE = 127, so encoderId=127 have no
problem.
> Replace HashMap to Array for DataBlockEncoding.idToEncoding
> -----------------------------------------------------------
>
> Key: HBASE-17332
> URL: https://issues.apache.org/jira/browse/HBASE-17332
> Project: HBase
> Issue Type: Improvement
> Affects Versions: 2.0.0
> Reporter: binlijin
> Assignee: binlijin
> Fix For: 2.0.0
>
> Attachments: DBE.idToEncoding.png,
> DBE.idToEncoding_afterOptimize.png, HBASE-17332.V2.patch, HBASE-17332.patch
>
>
> Array is faster than HashMap also no need to autoboxing.
> I can see the DataBlockEncoding#getDataBlockEncoderById is a hot method if
> enable encoding in my perf test(Random read, all data cache in
> LruBlockCache).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)