summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-05-07 00:49:40 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-05-07 00:49:40 (GMT)
commitc8d2290c8c5111b2b735482fab6cd2c47a6a8977 (patch)
treea8dbcebb6836d98a98282cfe079bcb891aa3862a /Objects/dictobject.c
parent9f5178abb7edd1b1bcaffcdfcf1afd8816dab102 (diff)
downloadcpython-c8d2290c8c5111b2b735482fab6cd2c47a6a8977.zip
cpython-c8d2290c8c5111b2b735482fab6cd2c47a6a8977.tar.gz
cpython-c8d2290c8c5111b2b735482fab6cd2c47a6a8977.tar.bz2
SF patch #729395: Dictionary tuning
Adjust resize argument for dict.update() and dict.copy(). Extends the previous change to dict.__setitem__().
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index f3adc0b..c4959ff 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1151,7 +1151,7 @@ PyDict_Merge(PyObject *a, PyObject *b, int override)
* that there will be no (or few) overlapping keys.
*/
if ((mp->ma_fill + other->ma_used)*3 >= (mp->ma_mask+1)*2) {
- if (dictresize(mp, (mp->ma_used + other->ma_used)*3/2) != 0)
+ if (dictresize(mp, (mp->ma_used + other->ma_used)*2) != 0)
return -1;
}
for (i = 0; i <= other->ma_mask; i++) {
@@ -1236,7 +1236,7 @@ PyDict_Copy(PyObject *o)
if (copy == NULL)
return NULL;
if (mp->ma_used > 0) {
- if (dictresize(copy, mp->ma_used*3/2) != 0)
+ if (dictresize(copy, mp->ma_used*2) != 0)
return NULL;
for (i = 0; i <= mp->ma_mask; i++) {
entry = &mp->ma_table[i];