PyOpinion: Does Python Programming Marginalize You?

Rainer Deyke root at rainerdeyke.com
Wed Jun 7 12:54:14 EDT 2000


Ken Seehof <12klat at sightreader.com> wrote in message
news:393DDDF8.DE0401BB at sightreader.com...
> Rainer Deyke wrote:
> > Write an optimizing compiler that increase performance by a factor of at
> > least 100 and decreases memory usage by a factor of at least 100.
Python in
> > its current incarnation is too inefficient to be useful as primary
language
> > for shrink-wrapped software.
>
> Because of it's dynamic nature, Python simply can't be optimized all that
much
> (read about all that type inference stuff and you'll see what I mean).

A truly good optimizer might do wonders by analysing the entire system.  For
example, it sees that a certain name can only reference objects of certain
type, so it bypasses the generic access mechanism.  It sees that instances
of class X only get attributes from a certain set, so the dictionary is
replaced by a more efficient data structrure.  In general, if a human can
read a python program and produce an equivalent efficient assembly program,
a computer should be able to get close.

> Fortunately that just doesn't matter!
>
> 98% of code does not need to run fast.  You write the other 2% in C.
> 98% of all objects (on a per-object basis) do not need to be packed tight.
You
> implement the other 2% in C.
>
> Conclusion: The primary language does not need to be efficient.

But this involves complicated maneuvering between Python and C.  In many
instances it is easier to just write the program in straight C.


--
Rainer Deyke (root at rainerdeyke.com)
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list