Grant Edwards wrote: > 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()
OK, I'm still trying to pick my jaw up off of the floor. One question... how big of a file could this method create? 20GB, 30GB, limit depends on filesystem, etc? > That should be almost instantaneous in that the time required > for those 4 lines of code is neglgible compared to interpreter > startup and shutdown. -- http://mail.python.org/mailman/listinfo/python-list