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 serhiy.storchaka
Recipients ncoghlan, rhettinger, serhiy.storchaka
Date 2015-06-21.12:34:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There is a difference between Python and C implementations of functools.lru_cache(). Python implementation caches the hash of the key, C implementation doesn't. May be this is not too important (at least I have no an example that shows the benefit of caching the hash), but there is a place for possible optimization. Proposed patch uses private functions _PyDict_GetItem_KnownHash() and _PyDict_SetItem_KnownHash() to avoid the second calculating of the hash for new keys.

The hash is still calculated second time when the key is deleted from full cache. To avoid this _PyDict_DelItem_KnownHash() is needed.
Date User Action Args
2015-06-21 12:34:02serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, ncoghlan
2015-06-21 12:34:02serhiy.storchakasetmessageid: <>
2015-06-21 12:34:02serhiy.storchakalinkissue24483 messages
2015-06-21 12:34:01serhiy.storchakacreate