A faster Python?, Python compiler, Dylan,...

Michael Hudson mwh at python.net
Wed Apr 3 08:15:21 EST 2002


Jan Kybic <kybic at ieee.org> writes:

> Hello,
>         this is a post in favour of a faster Python:
> 
> 
> > Or are there any hints that Numric is really way slower than Matlab?
> 
> In my field (signal and image processing) and on high-level tasks,
> Python+Numeric runs at the same speed as the equivalent Matlab code.
> I have one big application that I basically wrote twice for both
> platforms and that's the conclusion I made.
> 
> On the other hand, all the calculation that you cannot express using
> high-level primitives (using matrices, vectors,...) and has to be
> performed with loops element by element, is painfully slow. Equally
> slow in Python, as in IDL, Matlab,... It is so slow that it is
> unusable, it is very difficult to develop an algorithm if it takes
> days to process any reasonably sized input. My solution is to rewrite
> the critical part of the code in C/C++, I did this for Matlab,
> Python+Numeric, as well as IDL, but this is awkward - it forces you to 
> work simultaneously with two languages and to deal besides the algorithm
> itself with a lot of implementation and interface details.
> 
> In fact, it has become such a burden, that I am seriously considering
> switching to another language. The only problem is that I still have
> not found anything high-level, elegant, fast, and free at the same time.

If you're at INRIA, why aren't you using ocaml already? <wink>

> It would be so much easier if I could just compile parts of the
                                        ^^^^
You make it sound so simple...

> Python code into the machine code. This would enable to use Python
> both for the prototyping and for the production code.

Have you looked at psyco?

> One poster said that a true Python compiler is not feasible due to
> Python's dynamic nature. My reponse to this is that I am quite willing 
> to add (optional) typing information on variables to assist the
> compiler to generate an efficient code. I have recently came across
> the language Dylan which permits just that. I think this is a feasible
> way of improving the Python performance.
> 
> I would love to hear your thoughts on the subject. 

Well, there was boundless (it made me exceed my quota on the mail
server I was using ot the time) discussion on the types-sig on
more-or-less this sort of topic a couple of years back, although
perhaps more of the focus was on guaranteeing correctness than
optimization.  You could read that, but you don't want to.

It's possible, perhaps even desirable, that psyco could be extended in
this fashion.  Got a spare man-month or so?  I haven't.

Cheers,
M.



More information about the Python-list mailing list