On 2006-01-27, rbt <[EMAIL PROTECTED]> wrote: > I've been doing some file system benchmarking. In the process, I need to > create a large file to copy around to various drives. I'm creating the > file like this: > > fd = file('large_file.bin', 'wb') > for x in xrange(409600000): > fd.write('0') > fd.close() > > This takes a few minutes to do. How can I speed up the process?
Don't write so much data. f = file('large_file.bin','wb') f.seek(409600000-1) f.write('\x00') f.close() That should be almost instantaneous in that the time required for those 4 lines of code is neglgible compared to interpreter startup and shutdown. -- Grant Edwards grante Yow! These PRESERVES at should be FORCE-FED to visi.com PENTAGON OFFICIALS!! -- http://mail.python.org/mailman/listinfo/python-list