-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Memory overhead
Estimates were performed using Java Agent for Memory Measurements to calculate the runtime size. The size may be affected by compressed references, object padding, etc. applied by the JVM. This benchmark may be run using gradle memoryOverhead
which executes MemoryBenchmark.
By forking Java 5's ConcurrentHashMap, Guava has a slight advantage with per-entry optimizations. This is evident when weak and soft reference caching is used. Caffeine must retain additional fields to remove a collected entry due to decorating a Java 8 ConcurrentHashMap.
Caffeine may lazily initialize or dynamically resizes its internal data structures based on usage. This reduces the footprint in favor of using additional memory only as required to meet usage demands (e.g. throughput).
Cache | Baseline | Entry |
---|---|---|
Caffeine | 264 bytes | 54 bytes (56 aligned) |
Guava | 1,032 bytes | 58 bytes (64 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,112 bytes | 74 bytes (80 aligned) |
Guava | 1,384 bytes | 74 bytes (80 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,152 bytes | 82 bytes (88 aligned) |
Guava | 1,384 bytes | 74 bytes (80 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,176 bytes | 90 bytes (96 aligned) |
Guava | 1,544 bytes | 90 bytes (96 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,168 bytes | 90 bytes (96 aligned) |
Guava | 27,200 bytes (?) | 90 bytes (96 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,120 bytes | 82 bytes (88 aligned) |
Guava | 1,376 bytes | 74 bytes (80 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,008 bytes | 82 bytes (88 aligned) |
Guava | 1,384 bytes | 74 bytes (80 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,008 bytes | 82 bytes (88 aligned) |
Guava | 1,192 bytes | 74 bytes (80 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 1,048 bytes | 98 bytes (104 aligned) |
Guava | 1,544 bytes | 90 bytes (96 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 560 bytes | 98 bytes (104 aligned) |
Guava | 1,240 bytes | 66 bytes (72 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 560 bytes | 98 bytes (104 aligned) |
Guava | 1,240 bytes | 74 bytes (80 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 616 bytes | 130 bytes (136 aligned) |
Guava | 1,416 bytes | 82 bytes (88 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 616 bytes | 146 bytes (152 aligned) |
Guava | 1,416 bytes | 98 bytes (104 aligned) |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 560 bytes | 114 bytes (120 aligned) |
Guava | 1,240 bytes | 90 bytes (96 aligned) |