Strange performance issue

Dan Stromberg drsalists at gmail.com
Tue Oct 6 01:31:05 EDT 2009


I'm rewriting 3 programs as one program - from Python with Tkinter to 
Python with pygtk, both on Windows XP.

My new version formats an SD card and preallocates some file space in 
about 3 minutes with "Optimize Performance" selected, and in about 30 
minutes with "Optimize for Quick Removal" selected.  Needless to say, I 
don't like the 27 minute penalty much.

But the old version of the program formats and preallocates in 3 minutes 
irrespective of whether the drive is in "optimize performance" or 
"optimize for quick removal".

I'm baffled.  I've gone over the old code, and found nothing relevant 
looking, and I've never seen anything this puzzling in my years of work 
on *ix.

Can someone please elucidate?

(I've also written a pair of minimal programs in Python and C that 
exhibit the same behavior on this XP system - so it's not just my GUI app)

Thanks!

PS: Here's the minimal python test program I mentioned.  It's dog slow 
unless I Optimize for Performance the drive.:

#!/cygdrive/c/Python26/python

import os
import time

one_meg = 'a'*2**20

t0 = time.time()

i = 0

file = open('remove-me', 'w')
while True:
       i += 1
       file.write(one_meg)
       t1 = time.time()
       bits_written = i*2**20*8
       duration = t1-t0
       print i, str(duration)+'s', bits_written/(duration*1024*1024), 
'Mbps'
       if duration > 120:
               break
file.close()

os.unlink('remove-me')




More information about the Python-list mailing list