Skip to content

Conversation

@FastAtlas
Copy link

@FastAtlas FastAtlas commented Sep 8, 2021

Hi,

We find that there are several inefficient usages of Java Collections:

  1. 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.
  2. 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

@zhuyuqing zhuyuqing self-requested a review September 9, 2021 01:08
@zhuyuqing
Copy link
Collaborator

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.

@iznauy iznauy self-requested a review September 9, 2021 02:53
FastAtlas and others added 2 commits September 9, 2021 10:58
@iznauy
Copy link
Contributor

iznauy commented Sep 9, 2021

Hi, thank you for your contribution! :D The majority of them are correct.

@FastAtlas
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants