Speed quirk: redundant line gives six-fold speedup
Bill Mill
bill.mill at gmail.com
Thu Aug 25 13:35:04 EDT 2005
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 see no difference in execution times, as expected. The most likely
> explanation is simply that other things were going on on your system
> when you ran the first test, but not the second test, resulting in the
> discrepancy. In other words, the speed change had nothing to do with
> your dummy lines.
>
Unlikely; 2 people have confirmed these results already.
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...
Peace
Bill Mill
bill.mill at gmail.com
More information about the Python-list
mailing list