[Python-Dev] Simpler reformulation of C inheritance Q.
Christian Tismer
tismer@tismer.com
Tue, 06 Aug 2002 17:58:43 +0200
Michael Hudson wrote:
[slots in types]
> I would wonder how much this saves.
>
> How many more instructions does
>
> PyDict_GetItem(ob->ob_type->tp_dict, interned_string)
>
> take than
>
> ob->ob_type->tp_my_field->mf_my_method
>
> ? Sure, *some* but not all that many esp. if the called function is
> actually doing significant work.
The comparison doesn't hit the nail (as you explain
as well), since what I do right now is to call
a highly optimized C function, directly, and the
speed concerns are mainly for my C API, which is
supposed to be much faster then the Python interface.
Having to call anything but my builtin stuff hurts.
So I want at least to 'know' that my function is
not overridden, and be able to call the builtin stuff.
Doing the call all the time via
ob->ob_type->tp_my_field->mf_my_method
would be nice, but I'd even be pleased with some flag.
But there is no space for nothing in a type.
Second, this is most time critical code, since my
tasklet switching is now very fast (half the time
of a function call from Python) for my CFrames.
And now people ask for overriding there, which hurts
me most possible. I will either find the solution,
or leave it as it is and ask C programmers to
"grab the thing if you want the overridden method".
...
> I doubt my opinion counts here, but I think I'd prefer to see *less*,
> not more, methods in type object in future. Particularly if there's
> some way to call functions with known signatures efficiently.
> Unfortunately, that seems pretty hard after five minutes thinking.
I'm not going to introduces masses of new methods for
type objects, but a generic way to introduce private
stuff.
not-easy-to-stop-me-anyway-at-all-ly y'rs -- chris
--
Christian Tismer :^) <mailto:tismer@tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/