Smaller footprint for Java collections
Joseph Yossi Gil, Yuval Shimron · 2011
Bloat, specifically, containers's bloat is a potential Java performance bottleneck. We identify five memory compaction techniques that can be used to reduce the footprint of the small objects that make containers. Using these techniques, we describe methods for more efficient encoding of some JRE's ubiquitous data structures. For HashMap and HashSet the fused hashing encoding method, reduces memory overhead by 20%-45% on a 32-bit environment and 45%-65% on a 64-bit environment. This encoding guarantees these figures as lower bound regardless of the distribution of keys in hash buckets. A more opportunistic quashed hashing encoding method, achieves expected savings of 25%-70% on a 32-bit environment and 30%-75% on a 64-bit environments. For TreeMap and TreeSet we employ these five techniques, and capitalizing further on the special properties of the red-black balanced tree, we can reduce the overhead of tree nodes by 43%-55% on a 32-bit environment and 59%-61% on a 64-bit environment.