This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger
Date 2012-11-26.20:26:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1353961574.84.0.437047945536.issue16562@psf.upfronthosting.co.za>
In-reply-to
Content
The code for dict_equal() in Objects/dictobject.c currently loops over the key/value pairs in self and uses PyDict_GetItem() to check for the corresponding key/value pair in the other dictionary.  This causes an unnecessary call to PyObject_Hash().

Instead, the code should loop over the key/value/hash triplets in self and do a direct lookup in the other dictionary with " ep = (otherdict->ma_lookup)(otherdict, key, hash)".   The reuses the known hash value for the key; thereby avoiding the potentially slow call to PyObject_Hash().

See _PyDict_Contains() for an example of how to do a lookup when the hash value is already known.

Note, the optimized path should be used only when PyDict_CheckExact() is true.
History
Date User Action Args
2012-11-26 20:26:14rhettingersetrecipients: + rhettinger
2012-11-26 20:26:14rhettingersetmessageid: <1353961574.84.0.437047945536.issue16562@psf.upfronthosting.co.za>
2012-11-26 20:26:14rhettingerlinkissue16562 messages
2012-11-26 20:26:14rhettingercreate