writing large files quickly

Ivan Voras ivoras at __yahoo__.com_
Sat Jan 28 09:03:14 EST 2006


Jens Theisen wrote:
> Ivan wrote:

>>Yes, but AFAIK the only "modern" (meaning: in wide use today) file
>>system that doesn't have this support is FAT/FAT32.
> 
> I don't think ext2fs does this either. At least the du and df commands  
> tell something different.

ext2 is a reimplementation of BSD UFS, so it does. Here:

f = file('bigfile', 'w')
f.seek(1024*1024)
f.write('a')

$ l afile
-rw-r--r--  1 ivoras  wheel  1048577 Jan 28 14:57 afile
$ du afile
8	afile

> Actually I'm not sure what this optimisation should give you anyway. The  
> only circumstance under which files with only zeroes are meaningful is  
> testing, and that's exactly when you don't want that optimisation.

I read somewhere that it has a use in database software, but the only 
thing I can imagine for this is when using heap queues 
(http://python.active-venture.com/lib/node162.html).



More information about the Python-list mailing list