[Python-Dev] Idea for a fast calling convention

Christian Tismer tismer at stackless.com
Mon Mar 1 08:04:37 EST 2004


Michael Hudson wrote:

> Christian Tismer <tismer at stackless.com> writes:
> 
> 
>>p.s.: I believe some automatic source analysis and rewrite might pay
>>off in other areas as well. Grepping through the sources, there are
>>still very many similar patterns of PyArg_ParseTupleXXX calls, which
>>could be replaced by less general, optimized versions.  This would
>>even *not* cause code bloat, since all those calling sequences would
>>be smaller than now.
> 
> 
> Well, yes.  C sucks seriously for things like this, though.  It's
> frankly embarassing that *every* time, say, ''.split() is called, some
> silly string is being parsed.  Unclear what to do about this (excpet
> PyPy, I guess).

Why not a switch over the arg tuple size?
Or do you mean, this happens in so many different places that
it would be tedious to change that by hand.
Sure, we should not try to morph Pytho into PyPy in the first
place.
But maybe some runtime analysis with a modified version
of PyArg_Parse... things, we could see how often which
format string appears, and how often which optional paths
are used, as a hint for hand optimisation.

I could do that with Stackless, btw. For Win32, I have a few
introspection tools which can do C stack analysis from
a debug build and find out what is being called. They were meant
for later C stack synthesis, which never worked, but this would
give them some use, again.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.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  mobile +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/




More information about the Python-Dev mailing list