[pypy-commit] pypy default: More tweaks
arigo
noreply at buildbot.pypy.org
Tue Jul 8 19:49:08 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r72393:8920909d084e
Date: 2014-07-08 19:48 +0200
http://bitbucket.org/pypy/pypy/changeset/8920909d084e/
Log: More tweaks
diff --git a/rpython/rtyper/lltypesystem/rdict.py b/rpython/rtyper/lltypesystem/rdict.py
--- a/rpython/rtyper/lltypesystem/rdict.py
+++ b/rpython/rtyper/lltypesystem/rdict.py
@@ -805,6 +805,8 @@
ll_clear.oopspec = 'dict.clear(d)'
def ll_update(dic1, dic2):
+ if dic1 == dic2:
+ return
ll_prepare_dict_update(dic1, dic2.num_items)
entries = dic2.entries
d2len = len(entries)
@@ -827,7 +829,13 @@
# (d.resize_counter - 1) // 3 = room left in d
# so, if num_extra == 1, we need d.resize_counter > 3
# if num_extra == 2, we need d.resize_counter > 6 etc.
- jit.conditional_call(d.resize_counter <= num_extra * 3,
+ # Note however a further hack: if num_extra <= d.num_items,
+ # we avoid calling _ll_dict_resize_to here. This is to handle
+ # the case where dict.update() actually has a lot of collisions.
+ # If num_extra is much greater than d.num_items the conditional_call
+ # will trigger anyway, which is really the goal.
+ x = num_extra - d.num_items
+ jit.conditional_call(d.resize_counter <= x * 3,
_ll_dict_resize_to, d, num_extra)
# this is an implementation of keys(), values() and items()
More information about the pypy-commit
mailing list