is c faster?
rnd at onego.ru
Sat Jun 9 02:28:16 EDT 2001
On Sat, 9 Jun 2001, akhar wrote:
> I have a script I wrote in python , I love the time it took me to devellop
> it faster than i could have done it in C. however after full review of my
> code I am not sure I can optimize it any more( it basicaly consist of
> importing an image and tranforming into a matrix to perform some for-looped
> operations on it) : I went from 20 seconds to 2. I can't seem to bring the
> execution time down :( . would C code be faster? by what factor? can I
> optimise my code more? how?
It varies depending on the task.
You can look at http://www.bagley.org/~doug/shootout/craps.shtml
- check boxes appropriate to your task and
- and you will see the picture.
My experience is that on large text-processing tasks
Perl is only 2 times slower than C and Python
only 2.5-3 times slower than C.
You can also use profiler to find out where time is spent.
> NB: I have a dual-celeron 400mhz with 256Mo of ram and a 20 gig 7200rpm HDD
> Also anybody with a G4 with PIL and numpy install to test the speed of my
> code?(my friend has a 1GHz and it takes him .65 sec to execute I would like
> to know if an altivec enhanced computer would fair better)
Sincerely yours, Roman A.Suzi
- Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
More information about the Python-list