Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-6298

Java collection use optimized

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: Trunk
    • Fix Version/s: None
    • Component/s: ALL COMPONENTS

      Description

      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

      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).

      more documentation on :

      For Map between HashMap and LinkedHashMap :

      Javolution Map Iterators return items in insertion sequence (HashMap does not), so any code relying on the original insertion order must use a LinkedHashMap.

      For Set beetwen HashSet and LinkedHashSet. (OFBIZ-6299)

      If you detect an optimization, please comments this issues

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nmalin Nicolas Malin
                Reporter:
                nmalin Nicolas Malin
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: