Speed?

EP EP at zomething.com
Sat Jan 3 02:01:15 EST 2004


On questions of the suitability of Python for CGI, embedded apps, etc., 
execution speed comes to mind.  I previously read some comparisons which 
did not show Python in a good light in this regard: i.e. Python is slow 
compared to Perl, C++, Java.

http://www.flat222.org/mac/bench/

Is there more authoritative and current information IRT speed comparisons?

Is newer Python any faster?

Also, if Python is a bit slower in execution than some alternative 
languages, what do others do in practice to speed it up, and how much of 
that optimization do they do?  Or is a slower speed to be accepted like one 
learns to accept that their lovely bride takes a long time getting ready to 
go out ?

TIA,


Eric

P.S.  I tried to replicate the simple "console test" with Python 2.3 on my 
PC.  Using the Windows command prompt, on a reasonably modern PC (128MB 
RAM, 1.3 AMD chip),  I clocked 72.45 seconds to print the numbers up to 
999,999, which is more than 3x as long as the results reported in the link 
given.

Then running the same program out of IDLE I clocked 627.48 seconds printing 
the numbers only up to 99,999.  Perhaps that's a caution about launching 
any large processes out of IDLE?  Here's the  test script:

import time

def loop_time():
	start=time.time()
	for x in xrange(1000000):
	    print x
	end=time.time()
	exectime=end-start
	return exectime

nada=raw_input('Press return when ready')
run=loop_time()
print 'Timed loop ran for:    '+str(run)+'  seconds'






More information about the Python-list mailing list