This patch changes the array list size increase to ~50% rather than doubling in line with what OpenJDK does. OpenJDK still doubles the size of vectors, as that's documented behavior.

Feedback appreciated,
Ian
--
http://www.cs.man.ac.uk/~irogers/
--- components/classpath/97.1p6/classpath/java/util/ArrayList.java      
2008-05-19 09:28:13.000000000 +0100
+++ libraryInterface/GNUClasspath/LGPL/src/java/util/ArrayList.java     
2008-05-27 11:24:58.000000000 +0100
@@ -173,7 +173,7 @@
 
     if (minCapacity > current)
       {
-        E[] newData = (E[]) new Object[Math.max(current * 2, minCapacity)];
+        E[] newData = (E[]) new Object[Math.max((current * 3) / 2 + 1, 
minCapacity)];
         System.arraycopy(data, 0, newData, 0, size);
         data = newData;
       }

Reply via email to