Speed: bytecode vz C API calls
Jacek Generowicz
jacek.generowicz at cern.ch
Wed Dec 10 11:54:50 EST 2003
"Terry Reedy" <tjreedy at udel.edu> writes:
> You presented an example function as taking a type (including new classes)
> as parameter. If your type domain is boundedly finite
It's unboundedly finite :-)
> and preknowable*, you could precompute the function for *all* inputs
> and replace the call with a dict lookup (or bound method for map).
>
> (*) If 'preknowable', could either create classes with factory function that
> adds them to cache or give metaclass that does same.
Hmmm ... all the non-builtin types in my domain are actually
dynamically created, and are themselves instances of a metaclass,
which could be instructed to add information about the new classes, to
the caches, as the classes are being created.
However, there are a number of problems I foresee (which I don't think
are particularly interesting to discuss here). Still, it could be put
to good use in some of the cases. I'll bear it in mind, thanks.
But first, I think that I'll try inlining the exception handler in
those cases where it can be done.
Cheers,
More information about the Python-list
mailing list