Message245593
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:02 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, ncoghlan |
2015-06-21 12:34:02 | serhiy.storchaka | set | messageid: <1434890042.2.0.0991345110525.issue24483@psf.upfronthosting.co.za> |
2015-06-21 12:34:02 | serhiy.storchaka | link | issue24483 messages |
2015-06-21 12:34:01 | serhiy.storchaka | create | |
|