writing large files quickly

Jens Theisen jth01 at arcor.de
Sat Jan 28 05:03:00 EST 2006


Donn wrote:

>> How the heck does that make a 400 MB file that fast? It literally takes
>> a second or two while every other solution takes at least 2 - 5 minutes.
>> Awesome... thanks for the tip!!!

> Because it isn't really writing the zeros.   You can make these
> files all day long and not run out of disk space, because this
> kind of file doesn't take very many blocks.   The blocks that
> were never written are virtual blocks, inasmuch as read() at
> that location will cause the filesystem to return a block of NULs.

Under which operating system/file system?

As far as I know this should be file system dependent at least under  
Linux, as the calls to open and seek are served by the file system driver.

Jens




More information about the Python-list mailing list