Slow Python - what can be done?

Riccardo Galli riccardo_cut-me at cut.me.sideralis.net
Thu Mar 18 21:37:29 CET 2004


On Thu, 18 Mar 2004 09:43:19 -0800, Jason wrote:

> Hey,
> 
> I'm an experience programmer but new to Python. I'm doing a simple
> implementation of a field morphing techinique due to Beier and Neely
> (1992) and I have the simple case working in Python 2.3 - but it's
> REALLY slow.
> 
> Basically, you specify two directed line segments in the coordinate
> system of a raster image and use the difference between those two
> lines to transform the image.
> 
> for a 400 x 600 image, python takes about 30 seconds to run the
> algorithm. This seems way to slow - I would expect it to run in a
> matter of a few seconds. Here's the code: what should I do to speed
> things up? I know I'm going to get a "do it in C/make a C extension"
> but that defeats the purpose: I'd like to know what Python can do
> here.
> 
> Thanks for your help.
> [SNIP]

I can't try your prog because I have not Tkinter,
but I think this app would gain a lot in performances using psyco.
http://psyco.sourceforge.net/   <-- home
http://psyco.sourceforge.net/psycoguide/index.html  <-- doc

The simplest way to use psyco is putting
import psyco
psyco.full()
after your imports.

Ciao,
Riccardo


-- 
-=Riccardo Galli=-

 _,e.
s~  ``
 ~@.   ideralis Programs
.   ol 
 `**~  http://www.sideralis.net



More information about the Python-list mailing list