On 13 Dec 2006 16:07:20 -0800, <b class="gmail_sendername">Chao</b> <<a href="mailto:devincyu@gmail.com">devincyu@gmail.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I've been trying to develop some numerical codes with python, however<br>got disappointed.<br><br>A very simple test,<br><br>a = 1.0<br><br>for i in range(1000):<br> for j in range(1000):<br> a = a+1<br><br>
unfortunately, it took 4.5 seconds to finish(my machines is fine. P4<br>3.0G, 1G RAM, it varies according to machine configuration, but should<br>be in the same level)<br><br>for matlab, the same operation took 0.1 seconds,
<br><br>I use numpy & scipy, they solve the problem most of the times, but<br>there are cases you can't avoid loops by vectors. I appreciate the<br>elegancy of python so much, but I guess I have to gave it up in these
<br>numerical codes.(image processing algorithms), for application<br>dev/scripting, it's still my first choice.<br><br>A good news is that the same code takes ruby 9.8 seconds.<br><br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list">
http://mail.python.org/mailman/listinfo/python-list</a></blockquote><div><br>Have you considered looking into Psyco? (<a href="http://psyco.sourceforge.net/">http://psyco.sourceforge.net/</a>) 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.
<br><br>Hope this helps,<br>Aidan Steele.</div></div>