Message245593
| 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 |
<1434890042.2.0.0991345110525.issue24483@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|