why is python slow?

Fernando Pereira pereira at cis.upenn.edu
Fri Mar 8 22:18:07 EST 2002


On 3/8/02 9:59 PM, in article 7xvgc6fnus.fsf at ruckus.brouhaha.com, "Paul
Rubin" <phr-n2002a at nightsong.com> wrote:

> Fernando Pereira <pereira at cis.upenn.edu> writes:
>> The irreducible fact is that Python needs extensive runtime type checks,
>> Java doesn't. One could argue that agressive inlining of built-in operations
>> and type checks followed by removal of redundant machine instructions might
>> have the effect of removing most type checks, but that needs to be shown.
> 
> 40 years of Lisp compiler implementations have shown pretty conclusively
> that these problems are surmountable.

It's precisely because I know that history that I raise those points. I
don't want to dissect here the lessons of history, but the practical fact is
that the heroic optimization efforts of Lisp compilers have not proven to be
*economically* viable. That is, the cost of creating, maintaining, and
running such compilers has been huge relative to the lines of code that they
succeed in optimizing. It's easier to build compilers producing fast code
for statically typed languages. That is, the costs are spread over all the
programmers who have to obey compile-time type disciplines (and those costs
may be lower than one things, as those disciplines catch bugs), rather than
being concentrated on the compiler developers. This is not a critique of
dynamically-typed languages, but rather an observation from 25 years of
implementing and using such languages.

-- F




More information about the Python-list mailing list