Help with Code Object Caching

Michael Hudson mwh21 at cam.ac.uk
Mon Feb 28 12:34:09 EST 2000


Brent Fulgham <brent.fulgham at xpsystems.com> writes:

> My initial implementation is to Marshal the compiled code
> object into a PyString, then convert this into a "char*"
> of known length I can store in my Cache.
> 
> Then, when I am ready to execute, I build a new PyString
> from the char* and length, Marshal it back to a PyCodeObject,
> and execute that.
> 
> Before I go too far down this path, I just wanted to ask
> if there were any better alternatives that have already
> been implemented.  This seems like a problem that might have
> been solved by others already.
> 
> Any comments?

Sounds pretty good from here; I've not done anything much like this
before - but this is pretty close to what the marshal module was
written for, so it should work just fine (As I understand it, the
marshal module was written to enable saving of .pyc files).

Cheers,
M.

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list