[jira] [Created] (OFBIZ-6298) Java collection use optimized

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OFBIZ-6298) Java collection use optimized

Nicolas Malin (Jira)
Nicolas Malin created OFBIZ-6298:
------------------------------------

             Summary: Java collection use optimized
                 Key: OFBIZ-6298
                 URL: https://issues.apache.org/jira/browse/OFBIZ-6298
             Project: OFBiz
          Issue Type: Improvement
          Components: ALL COMPONENTS
    Affects Versions: Trunk
            Reporter: Nicolas Malin
            Assignee: Nicolas Malin
            Priority: Minor


With the javolution collection cleaning (OFBIZ-5169,OFBIZ-5781) , we need to realize a second pass to control what instantiation would be better.

For List between LinkedList, ArrayList
{quote}
Using ArrayList, rather than LinkedList, as a default is a good approach because ArrayList will work better in most situations (in terms of algorithmic runtimes and memory footprints).
However I think it is important to wisely choose ArrayList or LinkedList based on the context, because sometimes a linked list may be a better choice: I am not saying we should do it now and we can tackle this at a later moment, possibly focusing only on list that can be very big and analyzing their usage to see if array or linked list is better; it would be also nice, when we use ArrayList, to see if we can predict the capacity of the list and allocate it at creation: if we can do this we will have a more predictable memory usage and less unpredictable peaks under heavy load (when the array capacity is reached and the array is copied to a new one with double capacity).
{quote}
more documentation on :
 * https://docs.oracle.com/javase/tutorial/collections/implementations/list.html
 * http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist

For Map between HashMap and LinkedHashMap :
{quote}
Javolution Map Iterators return items in insertion sequence (HashMap does not), so any code relying on the original insertion order must use a LinkedHashMap.
{quote}

 * http://stackoverflow.com/questions/2889777/difference-between-hashmap-linkedhashmap-and-treemap

If you detect an optimization, please comments this issues



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)