Speed quirk: redundant line gives six-fold speedup
jay graves
jaywgraves at gmail.com
Thu Aug 25 13:31:03 EDT 2005
Mark Dickinson wrote:
> Questions:
> (1) Can anyone else reproduce this behaviour, or is it just some quirk
> of my setup?
yes. I get 7 sec vs 1 sec on my laptop.
> (2) Any possible explanations? Is there some optimization that kicks
> in at a certain number of lines, or at a certain length of
> bytecode?
I don't think there are any optimizations at play here.
> (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?
When I start a python interpreter and import the module the speed
difference disappears and it actually gets about two times faster.
YMMV.
I don't have a solution but I admire the problem. [1]
...
jay
[1] Google tells me that this is probably attributable to Ashleigh
Brilliant.
More information about the Python-list
mailing list