Message156808
| Author |
anacrolix |
| Recipients |
anacrolix, giampaolo.rodola, meador.inge, nedbat, rhettinger |
| Date |
2012年03月26日.10:53:31 |
| SpamBayes Score |
0.00028058313 |
| Marked as misclassified |
No |
| Message-id |
<1332759214.37.0.638978173116.issue14373@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I've fixed the commenting, and cache_info use.
I've left the element management in pure C as it reduces memory use (56 bytes for 4 element list, vs. 16 for lru_cache_elem), and avoids ref counting overhead (3 refs per link, plus GC). The difference might become quite marked for very large caches. There's also a nice invariant that links the key to the cache dict, and the result object to the lru_cache_elem. I'm happy to change this if it doesn't matter.
My only concern now is the wrapping of the lru cache object. In the Python version, @wraps allows the lru_cache to masquerade as the wrapped function wrt str/repr. The C version is wrapped, but str/repr remain unchanged. Not sure if this is a problem. |
|