[Python-Dev] todo (was: Joys of Optimization)

Jewett, Jim J jim.jewett at eds.com
Fri Mar 19 15:39:01 EST 2004


Is there some central location where these ideas (and any known
problems) are collected?  Perhaps the Request For Enhancement
tracker at sourceforge?

I have a feeling that most of my questions have been asked
before, but I don't know which ones, or where to find the
answers.

> If the threading module were re-coded in C, 

Does the python portion of threading really add much overhead?  
The obvious costs are for thread switches and calls back and 
forth between python and C.  Changing threading code to C might 
just move that cost from threading to the actual thread, without 
actually speeding up the program much.

> The peephole optimizer in compile.c ... however, they can't go
> in until the line renumberer is done.  For example, the code a,b=b,a
> currently runs slower than t=a;a=b;b=t but it could run several times
> faster if the BUILD_TUPLE 2 UNPACK_SEQUENCE 2 were replaced by ROT_TWO.

What is the cheapest fake NOOP?  Define a pass function at compile time
and call it for a NOOP?  Jump/jump-back?  Or are those just too ugly
to use?

> 5) Python's startup time got much worse in Py2.3.

Is there an easy way to create a daemon python, (or a not-quite-
unloaded library like MS Office), so that calls to python after
the first can just start a new thread in the already-loaded 
interpreter?  I think one of the Apache plugins does something
like this, but perhaps it has other problems that keeps it out of CVS?

> 4) eval() only takes real dictionaries as arguments.  ...  Previous
> proposals were rejected because they cost a percentage point or two of
> execution time 

Is it reasonable to make the funky environment pay a penalty?  For
instance, "process()" or "evaluate()" instead of eval.  These could
even be in a module that needs to be imported.  But if you're changing
dictionaries, you may also want to change the reader, or ensure that
the implementation does not add builtins, or ... so it might be worth
a PEP rather than just a weekend coding.

-jJ



More information about the Python-Dev mailing list