[Python-3000] Comment on iostack library

Ronald Oussoren ronaldoussoren at mac.com
Wed Aug 30 07:47:16 CEST 2006


On 30-aug-2006, at 7:26, Talin wrote:

> Guido van Rossum wrote:
>>
>> Regarding optimal buffer size, I've never seen a program for which 8K
>> wasn't optimal. Larger buffers simply don't pay off.

Larger buffers can be useful when doing binary I/O through stdio (at  
least on linux). I've recently had a program that had significant  
speedup when I used a 128K buffer.

>
> Well, as far as readline goes: In order to split the text into lines,
> you have to decode the text first anyway, which is a layer 3  
> operation.


And buffering is a layer 2 operation. Function calls are signficantly  
cheaper than system calls. You don't want to do a system call for  
every character read, but might get away with doing a function call  
per character.

Ronald



More information about the Python-3000 mailing list