内存占用

使用Java Agent for Memory Measurements执行Estimates以计算运行时间大小。 该大小可能受JVM应用的压缩引用,对象填充等的影响。 这个基准测试可以使用执行MemoryBenchmark的gradle memoryOverhead运行。

通过fork Java 5的ConcurrentHashMap,Guava在条目优化方面略有优势。 当使用弱和软引用缓存时,这尤其明显。 由于装饰了Java 8 ConcurrentHashMap,caffeine必须保留其他字段删除收集的条目。

Caffeine可能延迟初始化或根据使用情况动态调整其内部数据结构。 这减少了内存占用,有利于仅根据需要使用额外的存储器以满足使用需求(例如吞吐量)。

无界

Cache 基线 条目
Caffeine 264 bytes 54 bytes (56 对齐)
Guava 1,032 bytes 58 bytes (64 aligned)

Maximum Size

Cache 基线 条目
Caffeine 1,112 bytes 74 bytes (80 aligned)
Guava 1,384 bytes 74 bytes (80 aligned)

Maximum Size & Expire after Access

Cache 基线 条目
Caffeine 1,152 bytes 82 bytes (88 aligned)
Guava 1,384 bytes 74 bytes (80 aligned)

Maximum Size & Expire after Write

Cache 基线 条目
Caffeine 1,176 bytes 90 bytes (96 aligned)
Guava 1,544 bytes 90 bytes (96 aligned)

Maximum Size & Refresh after Write

Cache 基线 条目
Caffeine 1,168 bytes 90 bytes (96 aligned)
Guava 27,200 bytes(?) 90 bytes (96 aligned)

Maximum Weight

Cache 基线 条目
Caffeine 1,120 bytes 82 bytes (88 aligned)
Guava 1,376 bytes 74 bytes (80 aligned)

Expire after Access

Cache 基线 条目
Caffeine 1,008 bytes 82 bytes (88 aligned)
Guava 1,384 bytes 74 bytes (80 aligned)

Expire after Write

| Cache | 基线 | 条目 |

|--------|--------|--------| | Caffeine | 1,008 bytes | 82 bytes (88 aligned) | | Guava | 1,192 bytes | 74 bytes (80 aligned) |

Expire after Access & after Write

Cache 基线 条目
Caffeine 1,048 bytes 98 bytes (104 aligned)
Guava 1,544 bytes 90 bytes (96 aligned)

Weak Keys

Cache 基线 条目
Caffeine 560 bytes 98 bytes (104 aligned)
Guava 1,240 bytes 66 bytes (72 aligned)

Weak Values

Cache 基线 条目
Caffeine 560 bytes 98 bytes (104 aligned)
Guava 1,240 bytes 74 bytes (80 aligned)

Weak Keys & Weak Values

Cache 基线 条目
Caffeine 616 bytes 130 bytes (136 aligned)
Guava 1,416 bytes 82 bytes (88 aligned)

Weak Keys & Soft Values

Cache 基线 条目
Caffeine 616 bytes 146 bytes (152 aligned)
Guava 1,416 bytes 98 bytes (104 aligned)

Soft Values

Cache 基线 条目
Caffeine 560 bytes 114 bytes (120 aligned)
Guava 1,240 bytes 90 bytes (96 aligned)
Copyright © www.gitbook.com/@vitzhou 2016 all right reserved,powered by Gitbook该文件修订时间: 2018-02-11 03:39:24

results matching ""

    No results matching ""