Thanks for your suggestion. Because the lib will be included in the core jar, we wish the size of the lib could be as small as possible and the lib was independent. I find ConcurrentLinkedHashMap uses javax annotations, can we remove it simply？
在 "Ben Manes (JIRA)" <email@example.com>，2016年10月29日 下午12:12写道：
[ https://issues.apache.org/jira/browse/GROOVY-7977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15617386#comment-15617386 ]
Ben Manes commented on
ConcurrentLinkedHashMap is a 115 kb jar, but could be trimmed to 55 kb by removing the JDK8 ConcurrentHashMap backport. Note that Grails uses the library, as have many projects such as Cassandra, but all are gradually transitioning to Caffeine.
ConcurrentLinkedHashMap was project to investigate how to design a concurrent LRU cache, so its feature bare but very fast. In parallel Guava was working on MapMaker to be feature rich, but designed around soft references as the caching scheme. That of course leads to poor GC effects, so CLHM's ideas were scaffolded on and became CacheBuilder. Unfortunately in the process a lot of performance was lost and I left before being able to fix that.
Caffeine tries to push the boundaries further performance wise, feature wise, and policy wise. That leads to a more complex library, which is large due to code generation to reduce the runtime footprint.
ConcurrentLinkedHashMap is Java 6 based, easy to shade, and pretty straightforward. However its in maintenance mode and lacks richer features like memoization. It is a drop-in replacement for a synchronized LinkedHashMap based LRU cache, so its probably the easier fit.
This message was sent by Atlassian JIRA