How to make python run faster
aboudouvas at panafonet.gr
Mon Apr 14 22:09:40 CEST 2008
On 14 Απρ, 16:48, 一首诗 <newpt... at gmail.com> wrote:
> I read this article onhttp://kortis.to/radix/python_ext/
> And I decided to try if it's true.
> I write the program in 4 ways:
> 1. Pure C
> 2. Python using C extension
> 3. Python using psycho
> 4. Pure Python
> And then I used timeit to test the speed of these 4. Unsurprisingly,
> the time they cost were:
> 4 > 3 > 2 > 1
> But I did noticed that 2 is a least 3 times slower than 1, not as fast
> as the article stated.
> That's quite weird and I thought maybe it's because I am using
> Windows. I did the same test on Linux and I found 2 only uses 1.5
> times of time of 1.
> But, it is still not as fast as 1.
I have experimented too with this scenario. My conclusion is that it
aint worth it to mess with C. Program only in Python and when the time
comes that you want to speed up something, just use Psyco on this. And
that will be more than enough.
More information about the Python-list