Renting CPU time for a Python script
Chris Liechti
cliechti at gmx.net
Sat Jul 20 17:53:53 EDT 2002
zbortolo at vt.edu (Zachary Bortolot) wrote in
news:25c15ddd.0207201216.46eddd73 at posting.google.com:
> Unfortunately the bottleneck
> in my program lies with the PIL extension since I have to perform a
> lot of putpixel and getpixel operations, which are quite expensive in
> PIL.
numpy/Numeric is very efficient on vectors and matrices. maybe you could
convert the image, or parts of it, to a matrix and use Numeric to process
it.
function calls are relatively expensive, when you can formulate your
algorithm with numpy you'll get the loop over the elements/pixels in C for
free, which should give you some speedup (>>2).
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list