summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-10-22 12:04:32 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>1993-10-22 12:04:32 (GMT)
commit3bb8a05947fb67ed827dd1e8d7c0a982a1ff989e (patch)
treecb9c4f6b18f70822ade606f269fc043be542f5da /Objects/dictobject.c
parenta75d306e2b799aa891666899ca973bec82b2362b (diff)
downloadcpython-3bb8a05947fb67ed827dd1e8d7c0a982a1ff989e.zip
cpython-3bb8a05947fb67ed827dd1e8d7c0a982a1ff989e.tar.gz
cpython-3bb8a05947fb67ed827dd1e8d7c0a982a1ff989e.tar.bz2
Several optimizations and speed improvements.
cstubs: Use Matrix type instead of float[4][4].
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r--Objects/dictobject.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 527b062..2a51d51 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -242,6 +242,9 @@ mappinglookup(op, key)
err_badcall();
return NULL;
}
+#ifdef CACHE_HASH
+ if (!is_stringobject(key) || (hash = ((stringobject *) key)->ob_shash) == -1)
+#endif
hash = hashobject(key);
if (hash == -1)
return NULL;
@@ -260,6 +263,9 @@ mappinginsert(op, key, value)
err_badcall();
return -1;
}
+#ifdef CACHE_HASH
+ if (!is_stringobject(key) || (hash = ((stringobject *) key)->ob_shash) == -1)
+#endif
hash = hashobject(key);
if (hash == -1)
return -1;
@@ -289,6 +295,9 @@ mappingremove(op, key)
err_badcall();
return -1;
}
+#ifdef CACHE_HASH
+ if (!is_stringobject(key) || (hash = ((stringobject *) key)->ob_shash) == -1)
+#endif
hash = hashobject(key);
if (hash == -1)
return -1;
@@ -447,7 +456,11 @@ mapping_subscript(mp, key)
register object *key;
{
object *v;
- long hash = hashobject(key);
+ long hash;
+#ifdef CACHE_HASH
+ if (!is_stringobject(key) || (hash = ((stringobject *) key)->ob_shash) == -1)
+#endif
+ hash = hashobject(key);
if (hash == -1)
return NULL;
v = lookmapping(mp, key, hash) -> me_value;
@@ -628,9 +641,15 @@ mapping_compare(a, b)
res = cmpobject(akey, bkey);
if (res != 0)
break;
+#ifdef CACHE_HASH
+ if (!is_stringobject(akey) || (ahash = ((stringobject *) akey)->ob_shash) == -1)
+#endif
ahash = hashobject(akey);
if (ahash == -1)
err_clear(); /* Don't want errors here */
+#ifdef CACHE_HASH
+ if (!is_stringobject(bkey) || (bhash = ((stringobject *) bkey)->ob_shash) == -1)
+#endif
bhash = hashobject(bkey);
if (bhash == -1)
err_clear(); /* Don't want errors here */
@@ -661,6 +680,9 @@ mapping_has_key(mp, args)
register long ok;
if (!getargs(args, "O", &key))
return NULL;
+#ifdef CACHE_HASH
+ if (!is_stringobject(key) || (hash = ((stringobject *) key)->ob_shash) == -1)
+#endif
hash = hashobject(key);
if (hash == -1)
return NULL;