Python optimization (was Python's "only one way to do it" philosophy isn't good?)

Steve Howell showell30 at yahoo.com
Sun Jun 10 18:43:05 EDT 2007


--- John Nagle <nagle at animats.com> wrote:
> 
> With this, the heavy optimizations are possible. 
> Strength reduction.  Hoisting
> common subexpressious out of loops.  Hoisting
> reference count updates out of
> loops.  Keeping frequently used variables in
> registers.  And elimination of
> many unnecessary dictionary lookups.
> 

To the extent that some of these optimizations could
be achieved by writing better Python code, it would
nice for optimization tools to have a "suggest" mode. 
For example, if I code a Fourier series and duplicate
the subexpression n*f*t, it would be nice for a tool
to tell me that I should refactor that expression. 
Something like this:

   n*f*t should be refactored out of this expression,
assuming muliplication has no desired side effects for
n, f, and t.




 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/



More information about the Python-list mailing list