Python 2 times slower than Perl

Christopher A. Craig com-nospam at ccraig.org
Tue Jul 17 23:10:07 CEST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Day <mday at apple.com> writes:

> and not the multiplication.  I don't think Python will evaluate the
> expression at "compile" time, nor move the assignment outside the loop.

I can't speak for Perl, but Python definately does not evaluate the 
expression at compile time.  This is a problem I've had with Python.
I wish that when given the -O option the compiler would do constant
subexpression elimination.  

That said I created a Perl program that does $j *= 2.5 instead and it
still beat Python handsomely (on a Ultra 10).  I expect this is
because of the cost of dealing with so many Python object
creations/deletions which I've found can be quite a bit higher that C
entities.

- -- 
Christopher A. Craig <com-nospam at ccraig.org>
"Sir, your remarks are repugnant to me, and I disagree with your viewpoints.
But I will defend to the death your right to express them." Voltaire
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt

iEYEARECAAYFAjtUqa8ACgkQjVztv3T8pzu3IwCgndntxq+Ux5aWhNYMJ7QTW1TT
r9sAoLEdrpzGW3RbaFhCi1+Yx9dVaWXB
=5s/o
-----END PGP SIGNATURE-----



More information about the Python-list mailing list