Speed quirk: redundant line gives six-fold speedup

Bill Mill bill.mill at gmail.com
Thu Aug 25 14:12:19 EDT 2005


On 8/25/05, Jack Diederich <jack at performancedrivers.com> wrote:
> On Thu, Aug 25, 2005 at 01:35:04PM -0400, Bill Mill wrote:
> > On 8/25/05, Erik Max Francis <max at alcyone.com> wrote:
> > > Mark Dickinson wrote:
> > >
> > > > Questions:
> > > >
> > > > (1) Can anyone else reproduce this behaviour, or is it just some quirk
> > > >     of my setup?
> > > > (2) Any possible explanations?  Is there some optimization that kicks
> > > >     in at a certain number of lines, or at a certain length of
> > > >     bytecode?
> > > > (3) If (2), is there some way to force the optimization, so that I can
> > > >     get the speed increase without having to add the extra lines?
> > >
> >
> > I did find, though, that if I remove all print statements from the
> > program, the dummy and non-dummy variable versions take indentical
> > time. Can others reproduce this?
> >
> > I'm Investigating further...
> 
> I'm getting similarly freakish results.  I tried a little ghetto debugging
> by putting a printf in dictobject.c's resize method and recompiling python.
> Sadly I can't get the problem to reproduce itself with the new binary
> (with or without the printf).  The Ubuntu default 2.4.1 is sometimes fast,
> my hand compiled one (./configure && make) is always slow.
> 
> There are some very arcane low level things going on here.
> 

agreed. Also, either I was temporarily insane, or the version with the
explicit template no longer runs faster for me, so I hope nobody
spends a lot of time on that.

Peace
Bill Mill
bill.mill at gmail.com



More information about the Python-list mailing list