Mariano,

On 17 May 2011, at 15:21, Mariano Martinez Peck wrote:

> Now Igor told us for example, to use a buffer like this:
> 
>     | bufferStream |
>     bufferStream := ByteArray new writeStream.
> 
>     (FLSerializer on: bufferStream)
>         serialize: anArrayToSerialize.
> 
>     aFileStream nextPutAll: bufferStream contents. 
> 
> and that it at least 2 times faster than we were doing.... I guess it is 
> because it goes to the disk only once. But MultiByteFileStream uses a buffer, 
> doesn't it ?

The disadvantage of the above is that you buffer everything before you write. 
Furthermore you are growing the buffer all the time (recopying contents) which 
is not too efficient.

Some time ago we had a discussion about this and then I implemented 
ZnBufferedWriteStream (it should be in Core 1.3), have a look. It was just a 
quick hack, but it worked in speeding up writing.

Sven


Reply via email to