Python 2 times slower than Perl
Gareth McCaughan
Gareth.McCaughan at pobox.com
Thu Jul 19 19:24:22 EDT 2001
Radovan Garabik wrote:
> 1e6 is a real number, this comparision has to coerce i to real number
> better comparision would be with i<1000000
> for me, it improved the time from 4.65s to 4.14s
> and running with python -O cut it down to 3.92s
> (now this I do not quite understand... I thought -O
> just removes docstrings, doesn't it?)
It also removes the opcodes whose only purpose is to keep
track of line numbers within the source code. When you
have a tight loop that's doing almost nothing, losing those
can help. (It's the interpreter overhead, of course, not
the actual setting of the line number, that costs.)
--
Gareth McCaughan Gareth.McCaughan at pobox.com
.sig under construc
More information about the Python-list
mailing list