You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/09/04 07:44:03 UTC

[GitHub] [commons-codec] DittoTool opened a new pull request #92: Avoid inefficient usage of arraylist

DittoTool opened a new pull request #92:
URL: https://github.com/apache/commons-codec/pull/92


   Hi,
   We find that there are three ArrayList objects which are not manipulated by random access. Due to the memory reallocation triggered in the successive insertions, the time complexity of add method of ArrayList is amortized O(1). We notice that these objects are only used for traversal and the retrieval for the first or the last element.
   
   This functionality can be implemented by LinkedList. Moreover, the insertion of LinkedList is strictly O(1) time complexity because no memory reallocation occurs.
   
   We discovered this inefficient usage 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] garydgregory closed pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
garydgregory closed pull request #92:
URL: https://github.com/apache/commons-codec/pull/92


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] garydgregory closed pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
garydgregory closed pull request #92:
URL: https://github.com/apache/commons-codec/pull/92


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] DittoTool removed a comment on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
DittoTool removed a comment on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-912930932


   Besides, we also found several TreeMap objects, which are only used for key-value pair retrieval. It would be better to replace it with HashMap.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] jochenw commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
jochenw commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-919145623


   > I do not think we should change internals until we have an example that demonstrates whatever problem this tool thinks it found. This feels backward to me because accessing the first and/last element of an array is fast and an array list grows in chunks.
   
   I think exactly the same, which is why was asking for more infos.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] DittoTool commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
DittoTool commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-912930932


   Besides, we also found several TreeMap objects, which are only used for key-value pair retrieval. It would be better to replace it with HashMap.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] jochenw commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
jochenw commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-918998259


   Besides: What is the tool Ditto, that you ae referring to? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] coveralls commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-912931083


   
   [![Coverage Status](https://coveralls.io/builds/42655341/badge)](https://coveralls.io/builds/42655341)
   
   Coverage remained the same at 94.682% when pulling **c9d521b20256f15c4fc68beb57757f976a2a3110 on DittoTool:master** into **fd44e6b491c9d606d0b91ac0029269d265024cd9 on apache:master**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] coveralls edited a comment on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-912931083


   
   [![Coverage Status](https://coveralls.io/builds/42867060/badge)](https://coveralls.io/builds/42867060)
   
   Coverage remained the same at 94.682% when pulling **e1eff304480d120d9785cfab6d9687fa1d81dbf0 on DittoTool:master** into **fd44e6b491c9d606d0b91ac0029269d265024cd9 on apache:master**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] garydgregory commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-919118081


   I do not think we should change internals until we have an example that demonstrates whatever problem this tool thinks it found. This feels backward to me because accessing the first and/last element of an array is fast and an array list grows in chunks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] garydgregory commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-919119582


   Tree maps are also handy for reproducing the same result over and over, also needs a demonstration of what the problem is in pragmatic terms.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] garydgregory commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-1039581068


   Closing, no reply from OP.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] garydgregory commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-1039581068


   Closing, no reply from OP.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] jochenw commented on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
jochenw commented on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-918996199


   Are there any sources, that you can quote with regards to the complexity of ArrayList vs. LinkedList? Thanks, Jochen
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-codec] jochenw edited a comment on pull request #92: Avoid inefficient usage of arraylist

Posted by GitBox <gi...@apache.org>.
jochenw edited a comment on pull request #92:
URL: https://github.com/apache/commons-codec/pull/92#issuecomment-918998259


   Besides: What is the tool Ditto, that you are referring to? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org