writing large files quickly
casevh at comcast.net
casevh at comcast.net
Fri Jan 27 14:19:44 EST 2006
rbt 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?
>
> Thanks!
Untested, but this should be faster.
block = '0' * 409600
fd = file('large_file.bin', 'wb')
for x in range(1000):
fd.write('0')
fd.close()
More information about the Python-list
mailing list