[pypy-commit] pypy length-hint: (fijal) don't overalloc in resizelist_hint ge

pjenvey noreply at buildbot.pypy.org
Mon Sep 24 19:49:49 CEST 2012


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: length-hint
Changeset: r57514:5ec22166aed2
Date: 2012-09-24 10:48 -0700
http://bitbucket.org/pypy/pypy/changeset/5ec22166aed2/

Log:	(fijal) don't overalloc in resizelist_hint ge

diff --git a/pypy/rpython/lltypesystem/rlist.py b/pypy/rpython/lltypesystem/rlist.py
--- a/pypy/rpython/lltypesystem/rlist.py
+++ b/pypy/rpython/lltypesystem/rlist.py
@@ -223,9 +223,7 @@
     guess lied).
     """
     allocated = len(l.items)
-    if allocated < newsize:
-        _ll_list_resize_hint_really(l, newsize, True)
-    elif newsize < (allocated >> 1) - 5:
+    if allocated < newsize or newsize < (allocated >> 1) - 5:
         _ll_list_resize_hint_really(l, newsize, False)
 
 @enforceargs(None, int, None)


More information about the pypy-commit mailing list