I conducted several tests (not convincing, but very indicative) to establish the memory size of various implementations List<Map<String, Object>>. The base is Java ArrayList<>with elements that are instances of Guava ImmutableMap.
The implementations I compared are as follows:
- Based implementation
Map<String,List<Object>>using HashMapand ArrayLists; List<Object[]> ArrayList;- Guava
HashBasedTable<Integer,String,Object>; - Guava
ArrayTable<Integer,String,Object>;
n , m " " k, , . l, Apache Commons RandomStringUtils.
. n = 200000, m = 50, l = 10 k (1,0, 7,5, 0,5), :
| k = 1.0 | k = 0.75 | k = 0.5 |
----------------------------------------
1. | 71 % | 71 % | 71 % |
2. | 71 % | 72 % | 73 % |
3. | 111 % | 107 % | 109 % |
4. | 71 % | 73 % | 76 % |
n 20000 .
. , , 70% . -, , , Guava ArrayTable , , . , 1.