writing large files quickly

Jens Theisen jth01 at arcor.de
Sat Jan 28 09:54:00 EST 2006

Ivan wrote:

> 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


cp bigfile bigfile2

cat bigfile > bigfile3

du bigfile*
8       bigfile2
1032    bigfile3

So it's not consumings 0's. It's just doesn't store unwritten data. And I  
can think of an application for that: An application might want to write  
the biginning of a file at a later point, so this makes it more efficient.

I wonder how other file systems behave.

> 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).

That's an article about the heap efficient data structure. Was it your  
intention to link this?


More information about the Python-list mailing list