[Python-Dev] Idea for a fast calling convention

Michael Hudson mwh at python.net
Sat Feb 28 07:39:43 EST 2004


"Phillip J. Eby" <pje at telecommunity.com> writes:

> Maybe there should instead be a tp_call_stack slot.  Then the various
> CALL opcodes would call that slot instead of tp_call.  C API calls
> would still go through tp_call.

People *really* should look at the patch I mentioned...

> In practice, though, I expect it would be faster to do as Jython and
> IronPython have done, and define a set of tp_call1, tp_call2,
> etc. slots that are optimized for specific calling situations,
> allowing C API calls to be sped up as well, provided you used things
> like PyObject_Call1(ob,arg), PyObject_Call2(ob,arg1,arg2), and so on.

I think this only really helps when you have a JIT compiler of some
sort?

> Perhaps there is some information that can be gleaned from the Jython
> research as to what are the most common number of positional
> parameters for calls.

That's easy: 0 then 1 then 2 then 3 then insignificant.

Only a guess, but one I'm fairly confident of.

Cheers,
mwh

-- 
  ARTHUR:  Don't ask me how it works or I'll start to whimper.
                   -- The Hitch-Hikers Guide to the Galaxy, Episode 11



More information about the Python-Dev mailing list