Commits

Philip Jenvey  committed 4aaf1a4

an ootype _ll_resize_hint attempt

  • Participants
  • Parent commits 957f206
  • Branches length-hint

Comments (0)

Files changed (4)

File pypy/rpython/ootypesystem/ootype.py

             "_ll_resize_ge": Meth([Signed], Void),
             "_ll_resize_le": Meth([Signed], Void),
             "_ll_resize": Meth([Signed], Void),
+            "_ll_resize_hint": Meth([Signed], Void),
         })
 
         self._setup_methods(generic_types)

File pypy/rpython/rlist.py

     '_ll_resize_le':   (['self', Signed        ], Void),
     # resize to exactly the given size
     '_ll_resize':      (['self', Signed        ], Void),
+    # realloc the underlying list
+    '_ll_resize_hint': (['self', Signed        ], Void),
 })
 
 

File pypy/translator/cli/src/pypylib.cs

                 this._ll_resize_le(length);
         }
 
+        public void _ll_resize_hint(int length)
+        {
+            this.Capacity(length);
+        }
+
         public void _ll_resize_ge(int length)
         {
             if (this.Count < length) 

File pypy/translator/jvm/src/pypy/PyPy.java

             _ll_resize_le(self, length); 
     }
 
+    public static void _ll_resize_hint(ArrayList self, int length) {
+        self.ensureCapacity(length);
+    }
+
     // ----------------------------------------------------------------------
     // ll_math
     //