Speed: bytecode vz C API calls

Jacek Generowicz jacek.generowicz at cern.ch
Tue Dec 9 12:00:25 EST 2003


aahz at pythoncraft.com (Aahz) writes:

> Waitasec ....  okay, I see what your problem is, assuming you're
> describing it correctly.  The problem is that you're calling Python
> functions in an inner loop.

... indeedy ...

> I think you're going to need to write a solution that doesn't call
> functions (function unrolling, so to speak).  Instead of returning a
> memoizer function, just use a dict of dicts.

Sounds interesting. But how do I get the dictionary to use the
function which it is memoizing, to calculate values which haven't been
cached yet?

Hmm ... maybe by subclassing dict, I can add the necessary
functionality ... but even then I don't see how to avoid wrapping the
dictionary access in a function call ... and then we're back to square
one.





More information about the Python-list mailing list