ben-manes commented on code in PR #6679:
URL: https://github.com/apache/hbase/pull/6679#discussion_r1951188594
##########
hbase-common/pom.xml:
##########
@@ -110,6 +110,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-crypto</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.github.ben-manes.caffeine</groupId>
+ <artifactId>caffeine</artifactId>
+ </dependency>
Review Comment:
fwiw, if desired neither are necessary. The use-case appears to be an
unbounded concurrent map with a fast computeIfAbsent.
ConcurrentHashMap tends to lock pessimistically which impacts reads. While
improved in Java 9 to skip that if found on as the first item in the bin, it’s
rare. Caffeine does a lock-free get and falls back to a compute. This tends to
be much faster despite a little extra work. Here’s a [benchmark
run](https://jmh.morethan.io/?gists=511298014cc5629cbc5e57f09fd4c430) on the CI.
Just an fyi if helpful information.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]