IginX
IginX copied to clipboard
Inefficient Usages of Java Collections
Hi,
We find that there are several inefficient usages of Java Collections:
- There is no iteration occurring upon a LinkedHashMap and a TreeMap, thus the insertion order does not matter. We recommend replacing the LinkedHashMap and the TreeMap with a HashMap.
- ArrayList is inserted before an iteration, while multiple memory reallocation might occur when the size of the list exceeds its capacity. We recommend replacing it with a LinkedList.
We discovered the above inefficient usages of containers by our tool Ditto. The patch is submitted. Could you please check and accept it? We have tested the patch on our PC. The patched program works well.
Bests
Ditto
We highly welcome your contribution! Thank you! However, we think that we need to double-check the performance of the corresponding data structures/classes, as well as further evaluating the performance influence due to the changes. If it is convenient, your are welcomed to help us check the corresponding performance.
Hi, thank you for your contribution! :D The majority of them are correct.
Hi, thank you for your contribution! :D The majority of them are correct.
So happy to accept your confirmation. Ditto did not consider the transformations of variable types. The transformations might introduce compile errors. We will improve Ditto and fix it.