-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Memory overhead
Ben Manes edited this page Mar 30, 2015
·
18 revisions
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 dynamically resizes its internal data structures based on contention. This reduces the initial footprint in favor of using additional memory only as required to meet throughput demands.
Cache | Baseline | Entry |
---|---|---|
Caffeine | 656 bytes | 42 bytes |
Guava | 1,136 bytes | 58 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 552 bytes | 74 bytes |
Guava | 1,560 bytes | 74 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 584 bytes | 82 bytes |
Guava | 1,560 bytes | 74 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 616 bytes | 90 bytes |
Guava | 1,728 bytes | 90 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 608 bytes | 82 bytes |
Guava | 1,728 bytes | 90 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 504 bytes | 74 bytes |
Guava | 1,552 bytes | 74 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 560 bytes | 82 bytes |
Guava | 1,560 bytes | 74 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 560 bytes | 82 bytes |
Guava | 1,360 bytes | 74 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 608 bytes | 98 bytes |
Guava | 1,728 bytes | 90 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 496 bytes | 98 bytes |
Guava | 1,416 bytes | 66 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 496 bytes | 98 bytes |
Guava | 1,416 bytes | 74 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 552 bytes | 130 bytes |
Guava | 1,512 bytes | 82 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 552 bytes | 146 bytes |
Guava | 1,584 bytes | 90 bytes |
Cache | Baseline | Entry |
---|---|---|
Caffeine | 496 bytes | 114 bytes |
Guava | 1,416 bytes | 90 bytes |