Author rhettinger
Recipients anacrolix, giampaolo.rodola, meador.inge, nedbat, rhettinger
Date 2012-03-31.19:50:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333223429.21.0.390000351757.issue14373@psf.upfronthosting.co.za>
In-reply-to
Content
Matt, I'm attaching a pure python version to serve as a better map for how to implement this in C.

* it incorporate the recent lru_cache algorithmic updates (moving the root around the circular queue to re-use old links).

* it shows which parts should be implemented in C using a regular type and shows how to call it from pure python.

* it gives hints on use of #defines and PyDict_GetItem

* the critical sections are marked so you can use the GIL rather than using locks.

* there are hints for what datatypes to use (only the hits and misses need the ability to grow beyond sys.maxsize).

* it shows how to access the named tuple from within the C code (using a straight PyObject_Call).

* this code passes the test suite and should be directly translatable (and very fast).

* please follow the model and use PyList objects instead of C structure for links

* let me know if there are any questions.
History
Date User Action Args
2012-03-31 19:50:29rhettingersetrecipients: + rhettinger, giampaolo.rodola, nedbat, meador.inge, anacrolix
2012-03-31 19:50:29rhettingersetmessageid: <1333223429.21.0.390000351757.issue14373@psf.upfronthosting.co.za>
2012-03-31 19:50:28rhettingerlinkissue14373 messages
2012-03-31 19:50:28rhettingercreate