Why is Python so slow ?- revisited.

Mike Fletcher mfletch at tpresence.com
Sun Jun 18 19:55:41 EDT 2000


If I'm not mistaken, the most commonly executed bytecode in the interpreter
is set_lineno (or something similar).  Later versions of Python have a -O
flag that optimises out those byte codes (at the expense of debuggability).
The pattern encouraged seems to be to do all your debugging without the
flags, then generate -O versions when you want
faster-running-but-harder-to-debug versions.  Never actually _used_ the
pattern myself, of course, so I don't really know how much of a speed up it
gives.  Not particularly sure that comment lines require a set_lineno,
either, suppose I should let someone with a clue answer this question :) .

Also, don't discount the expense of an extra function call.  Function calls
were (and still are to a lesser extent) extremely heavy in Python five years
ago.

Enjoy yourself,
Mike

-----Original Message-----
From: William Dandreta [mailto:wjdandreta at worldnet.att.net]
Sent: Sunday, June 18, 2000 7:33 PM
To: python-list at python.org
Subject: Why is Python so slow ?- revisited.
...
The only thing that makes sense to me is that Python is spending 85% of the
time processing the comment lines and 15% of the time doing useful work.
There is a string.pyc so I would have assumed that it would not contain any
comments or descriptive strings but apparently that's not true.
...




More information about the Python-list mailing list