[pypy-commit] pypy rpython-hash: better fast path

arigo pypy.commits at gmail.com
Thu Jan 26 09:00:55 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: rpython-hash
Changeset: r89788:b24fe8a08009
Date: 2017-01-26 15:00 +0100
http://bitbucket.org/pypy/pypy/changeset/b24fe8a08009/

Log:	better fast path

diff --git a/rpython/rtyper/lltypesystem/rordereddict.py b/rpython/rtyper/lltypesystem/rordereddict.py
--- a/rpython/rtyper/lltypesystem/rordereddict.py
+++ b/rpython/rtyper/lltypesystem/rordereddict.py
@@ -876,7 +876,7 @@
         ll_dict_reindex(d, new_size)
 
 def ll_dict_create_index(d):
-    if d.num_live_items == 0:
+    if d.num_live_items < DICT_INITSIZE * 2 // 3:
         new_size = DICT_INITSIZE     # fast path
     else:
         # Use a more conservative estimate than _ll_dict_resize_to() here.


More information about the pypy-commit mailing list