Large HashMap overview:jdk, Fastutil, Goldman Sachs, HPPC, Koloboke, trove-january version:a Quick overview of Al L Major Libraries implementing hashmaps.
- Fastutil 6.6.0 turned out to be consistently fast. It may become even faster if it would introduce any other storage structures except 2 arrays for keys and values.
- Koloboke is getting second in many tests, but it still outperforms fastutil in int-int tests.
- Gs implementation is good enough, but is slower than Fastutil and Koloboke.
- JDK Maps is pretty good for object-object maps provided so can tolerate the extra memory consumption and you WI ll call
HashMap
constructor with required capacity = Actual_capacity/fill_factor + 1
to avoid rehashing.
- trove suffers from using ,
mod
operation for array index calculations AND HPPC is too slow due to a extra underlying array (for cell states).
Large HashMap overview:jdk, Fastutil, Goldman Sachs, HPPC, Koloboke, trove-january version:
http://java-performance.info/hashmap-overview-jdk-fastutil-goldman-sachs-hppc-koloboke-trove-january-2015/
Realize the HashMap of the mainstream library.
Keywords: hash map, Fastutil, GS collections, HPPC, Koloboke, Trove.
1. Fastutil 6.6.0 is still consistently fast. It may also be faster if you do not use a 2 array to store keys and values and use other storage structures.
2. Koloboke is ranked second in many tests, but is more than fastutil when the key value type is Int-int test.
3. The JDK behaves fairly well in object-object type (object-object) map. This requires you to endure additional memory consumption, and the additional consumption is that the actual capacity/fill factor + 1 (capacity = Actual_capacity/fill_factor + 1) is required to avoid re-hashing when constructing hashmap.
4. Trove suffers from the criticism of using modulo operations (mods) in array subscript calculations, and using an implicit extra array to preserve the state of the array elements makes the HPPC very slow. (HPPC http://labs.carrotsearch.com/hppc.html)
Translation www.java-performance.com------JDK class