Python's Performance

Terry Hancock hancock at anansispaceworks.com
Mon Oct 10 21:39:47 EDT 2005


On Monday 10 October 2005 01:21 pm, Donn Cave wrote:
> In article <mailman.1800.1128890475.509.python-list at python.org>,
> I am not very well acquainted with these technologies, but it sounds
> like variations on the implementation of an interpreter, with no
> really compelling distinction between them.  When a program is deployed
> as instructions in some form other than native code executable, and
> therefore those instructions need to be evaluated by something other
> than the hardware, then that would be some kind of interpretation.
> I agree that there are many shades of grey here, but there's also a
> real black that's sharply distinct and easy to find -- real native
> code binaries are not interpreted.

Please remember the context! Fredrik Lundh meant that anyone doing
*benchmarks* who called Python an interpreter was missing something
pretty important.   Since Python actually pre-compiles much of its
work, it acts more like a compiled language on many benchmarks.

In fact, this is true of many "interpreted" languages nowadays.

In particular, with regard to the original poster's question, the
fact that Python knows about and accesses attributes and methods
by their string name is not all that relevant -- the string
comparisons that are implied are generally optimized out (IIRC).

So it seems doubtful that Python does any more "string manipulation"
in the course of its usual execution than would any other language,
given the same tasks.

Admittedly, Python does encourage the kind of meta programming
that relies on knowing string names -- but I think that interning
strings remains an optimization even for most of those cases.

Assuming that Python will be slowed down because it has to
do a string comparison everytime it looks up an attribute is
assuming the dumbest possible interpreter design! (One which
works directly from the source text).

I think *that* was the point.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list