Why I love python.

John Roth newsgroups at jhrothjr.com
Thu Aug 12 21:42:58 EDT 2004


"Nick Patavalis" <npat at efault.net> wrote in message
news:slrncho5aq.pfh.npat at gray.efault.net...
> On 2004-08-13, Michael Scarlett <bitshadow at yahoo.com> wrote:
>
> Python needs drastic performance improvement if it is to scrap-off the
> "scripting language" stigma.

More performance would be helpful. There are a number
of projects that are working toward that end, of which
the most visible is the PyPy project. Jim Hughnin claims
that he's getting substantial improvements with his port
to the .Net framework, but see Fredrick Lundh's August
4 post on the subject.

As far as I'm aware, the biggest current performance
sink is function and method call overhead. Lookup for
module and built-in level variables is also a significant
time sink - and both module level and builtin identifiers
are used quite frequently.

Another thing to notice is the garbage collection
algorithm. Python uses reference counting as the
basic algorithm, which wasn't that bad a choice
a decade ago. Today real garbage collection
technology has outstripped it so that maintaining
the reference counts is another time sink.

The descriptor technology in new style classes
is a stunning techincal achievement, but in the
worst case it requires a full scan of the class
hierarchy before the mechanism can decide if
it's appropriate to insert an attribute into an
instance or invoke a property.

> The only way to get these improvements is
> making it possible for a python implementation
> to produce *efficient* *compiled* code.

I think there are lots of people that would dispute
you on that. Current Java environments run close
to C++ performance due to the JIT compilers
that are built into the runtimes. Current JIT
technology doesn't require pre-declaration of
variable types; it's perfectly happy to insert checks
at appropriate points so that it can reuse code when
the object types don't change (which they don't
most of the time.)

John Roth


> Just my 2c
> /npat
>





More information about the Python-list mailing list