On 13 Dec 2006 16:07:20 -0800, Chao <[EMAIL PROTECTED]> wrote:

I've been trying to develop some numerical codes with python, however
got disappointed.

A very simple test,

a = 1.0

for i in range(1000):
     for j in range(1000):
           a = a+1

unfortunately, it took 4.5 seconds to finish(my machines is fine. P4
3.0G, 1G RAM, it varies according to machine configuration, but should
be in the same level)

for matlab, the same operation took 0.1 seconds,

I use numpy & scipy, they solve the problem most of the times, but
there are cases you can't avoid loops by vectors. I appreciate the
elegancy of python so much, but I guess I have to gave it up in these
numerical codes.(image processing algorithms),  for application
dev/scripting, it's still my first choice.

A good news is that the same code takes ruby 9.8 seconds.

--
http://mail.python.org/mailman/listinfo/python-list


Have you considered looking into Psyco? (http://psyco.sourceforge.net/) For
all the numeric operations that image processing algorithms entail, such a
tool will probably make a tremendous difference in terms of speed of
execution for you. Do yourself a favour and check it out.

Hope this helps,
Aidan Steele.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to