[Tutor] Windows vs Linux processing speed.

bob gailer bgailer at gmail.com
Fri Oct 14 21:41:36 CEST 2011


On 10/14/2011 12:45 PM, Tony Pelletier wrote:
> Hi,
>
> I have a question regarding the speed of my program on linux in 
> comparison to windows.
[snip]

Speed of a pure Python program depends on

  * processor speed
  * competition for resources from other processes
  * perhaps RAM

A good starting point -create a benchmark program that uses only CPU - 
no disk, no internet.
Example:

import time
n = 100000 # a guess
start = time.time()
for i in range(n):pass
print time.time() - start

Be sure n is large enough to create a run time of at least several seconds.

Run it on Linux and on Windows.

Do a speed check on your internet connections.

Then modify the program to open & read the csv file inside the loop. You 
will have to reduce n when you add disk i/o

import time, csv
n = 10000 # a guess
start = time.time()
for i in range(n):
   for line in csv.reader(open(filename, "r")):pass
print time.time() - start
HTH

-- 
Bob Gailer
919-636-4239
Chapel Hill NC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111014/fbe4b24d/attachment.html>


More information about the Tutor mailing list