hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duo Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-16648) [JDK8] Use computeIfAbsent instead of get and putIfAbsent
Date Wed, 21 Sep 2016 02:49:20 GMT

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

Duo Zhang commented on HBASE-16648:

OK, I found the problem...

The map will not be empty every time as the test method will be invoked multiple times in
a iteration, so the get method is very important as we can eliminate most of the actual compute
or put operation... This is the reason why putIfAbsent is much faster. If I also add a get
method before computeIfAbsent then the speed will be almost same. Let me find a better way
to test the case where we always create a new object.


> [JDK8] Use computeIfAbsent instead of get and putIfAbsent
> ---------------------------------------------------------
>                 Key: HBASE-16648
>                 URL: https://issues.apache.org/jira/browse/HBASE-16648
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Performance
>    Affects Versions: 2.0.0
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>             Fix For: 2.0.0
>         Attachments: HBASE-16648-v1.patch, HBASE-16648-v2.patch, HBASE-16648.patch

This message was sent by Atlassian JIRA

View raw message