Creating a file with $SIZE
Robert Bossy
Robert.Bossy at jouy.inra.fr
Fri Mar 14 06:18:48 EDT 2008
Bryan Olson wrote:
> Robert Bossy wrote:
>
>> cokofreedom at gmail.com wrote:
>>
>>> Robert Bossy wrote:
>>>
>>>> Indeed! Maybe the best choice for chunksize would be the file's buffer
>>>> size...
>>>>
>
> That bit strikes me as silly.
>
The size of the chunk must be as little as possible in order to minimize
memory consumption. However below the buffer-size, you'll end up filling
the buffer anyway before actually writing on disk.
>> Though, as Marco Mariani mentioned, this may create a fragmented file.
>> It may or may not be an hindrance depending on what you want to do with
>> it, but the circumstances in which this is a problem are quite rare.
>>
>
> Writing zeros might also create a fragmented and/or compressed file.
> Using random data, which is contrary to the stated requirement but
> usually better for stated application, will prevent compression but
> not prevent fragmentation.
>
> I'm not entirely clear on what the OP is doing. If he's testing
> network throughput just by creating this file on a remote server,
> the seek-way-past-end-then-write trick won't serve his purpose.
> Even if the filesystem has to write all the zeros, the protocols
> don't actually send those zeros.
Amen.
Cheers,
RB
More information about the Python-list
mailing list