Commit 0ec031fa authored by Claudio Freire's avatar Claudio Freire

Initialize hashes during string init to enable hash-compare optimization

parent 17b1f1fe
...@@ -14,6 +14,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ ...@@ -14,6 +14,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
//////////////////// InitStrings //////////////////// //////////////////// InitStrings ////////////////////
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
long hash;
while (t->p) { while (t->p) {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (t->is_unicode) { if (t->is_unicode) {
...@@ -38,6 +39,9 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { ...@@ -38,6 +39,9 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
#endif #endif
if (!*t->p) if (!*t->p)
return -1; return -1;
hash = PyObject_Hash(*t->p);
if (hash == -1)
PyErr_Clear();
++t; ++t;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment