Saturday, December 01, 2007

คำนวณเลข Fibonacci ด้วย Python แบบไม่ช้านัก

ย้ายไป http://witpoko.com/?p=461 แล้วครับ

2 comments:

physica said...

Thank you Aj. Ko. :)

I have never tried psyco before (I surprise that 2 lines of code can save a lot of seconds.).
When I have to work with a lot of number manipulations, I use only numpy. This also save a computing time too.

Ko Saipetch said...

Yep, if you are doing numerically intensive calculation in Python, you should use numpy and/or psyco.

The key to make Python fast enough is to delegate as much work as possible to library functions since they are highly optimized. Of course, this assumes that we already choose an appropriate algorithm for our work.

On the other hand, a lazy+quick way is to enable psyco and see if anything improve!
:-D