"Phillip J. Eby" email@example.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.