On Tue, May 17, 2011 at 3:34 PM, Sven Van Caekenberghe <[email protected]>wrote:
> 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. > > Thanks Sven, what a great point you gave me. I tried it a little and I found a couple of methods missing which I used to use for a normal WriteStream. I will play a little more when I have time and I will ask you again!! -- Mariano http://marianopeck.wordpress.com
