Message156808
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. |
|
Date |
User |
Action |
Args |
2012-03-26 10:53:34 | anacrolix | set | recipients:
+ anacrolix, rhettinger, giampaolo.rodola, nedbat, meador.inge |
2012-03-26 10:53:34 | anacrolix | set | messageid: <1332759214.37.0.638978173116.issue14373@psf.upfronthosting.co.za> |
2012-03-26 10:53:33 | anacrolix | link | issue14373 messages |
2012-03-26 10:53:33 | anacrolix | create | |
|