orionlibs commented on PR #303:
URL: https://github.com/apache/commons-imaging/pull/303#issuecomment-1646286162

   > @gwlucastrig @kinow Any thoughts on array vs. set vs. list?
   
   it is true that there are no duplicate image extensions. Performance-wise:
   1--an ArrayList, under the hood, uses a dynamically resizing array to store 
its elements. So, the memory consumption would be the memory taken by each 
extension plus some overhead for the array itself. If the array is not full, 
there can be some wasted memory.
   2--a HashSet uses a HashMap under the hood. I think a HashSet would take 
more memory than an ArrayList as it needs to maintain the additional data 
structure (HashMap) with an extra constant value for every entry. The iterator 
of a HashSet is slower than an ArrayList because it needs to find the next 
non-null bucket every time.
   
   If that is true then the current implementation may be enough.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to